Can't Execute Master.dbo.xp_cmdshell Throught A Variable.

Dec 5, 2007



Hi all.

I've previous posted a message with error building the expression of the dtexec.exe string. But now, the problem is other, and I've decided to create other threat.

Here is what I'm doing:
I've a SP that receives every parameter so I can build my dtexec.exe statement to be executed by a variable with something like this exec @rc = master.dbo.xp_cmdshell @CMD


Till now I have no problem executing it, not from a variable, but just with the statement itself, like this:
exec master.dbo.xp_cmdshell 'C:PROGRA~2MICROS~290DTSBINNDTEXEC.EXE /SQ PACKAGE /SET "Package.Variables[PERIOD].Value";20070101'.

But now, I have this SP that builds the string into a variable and then I just want to execute it throught the variable like this: exec @rc = master.dbo.xp_cmdshell @CMD.

When I make a SELECT @CMD just before the exec @rc = master.dbo.xp_cmdshell @CMD, so it prints the builded string, copy it and pasted to exec master.dbo.xp_cmdshell 'copied string' it works fine. But the step of exec @rc = master.dbo.xp_cmdshell @CMD returns the error:
The filename, directory name, or volume label syntax is incorrect.

Why is this, if I copy the generated string and execute it by the other way it works fine, but executing the generated string throught the variable it gives me that error?

View 4 Replies


ADVERTISEMENT

Master..xp_cmdshell Error

Aug 28, 2007

I keep getting a "Incorrect syntax error near ' -Q''' " which is at the end of my xp_cmdshell line. What am I doing wrong?


CREATE Procedure dbo.sp_ImportRawData
(@ClientAbbrev nchar(4), @FileDate nvarchar(8), @SessionId nvarchar(50) )
AS
DECLARE @Msg varchar(255)
DECLARE @DataUpdates nvarchar(255)
DECLARE @Common nvarchar(255)
DECLARE @UServer nvarchar(255)
DECLARE @FullFileName nvarchar(68)
DECLARE @FileName nvarchar(64)
DECLARE @FileExt nvarchar(3)
DECLARE @SQL varchar(3500)
DECLARE @triFileName nvarchar(255)

Declare @Ip_FileName nvarchar(255)
Declare @Ip_Active char(1)



select @UServer = sd_value from Msysdata Where SD_Property = 'UpDateServer'
select @Common = sd_value from Msysdata WHERE SD_Property = 'CommonDir'
select @DataUpdates = sd_Value from Msysdata WHERE SD_Property = 'DataUpdate'

Set @UServer = @UServer + 'D$'

SET @Msg = 'Truncate tri_ active files'
EXEC MARS_SYS.dbo.sp_WriteLog @ClientAbbrev, 'UpdateMgr', @Msg, @FileDate, @SessionId



Declare ActiveFile Cursor For
Select Ip_FileName, Ip_Active from tbl_InputFiles
where Ip_Active = 'Y'

Open ActiveFile
Fetch Next From ActiveFile
Into @Ip_FileName, @Ip_Active


While @@Fetch_Status = 0
Begin

Exec('truncate table tri_'+ @Ip_FileName)
Set @FullFileName = @Ip_Filename + '.csv'



set @UServer = ''
set @Common = ''
set @triFileName = 'tri_' + @Ip_FileName

set @sql = 'master..xp_cmdshell ''' + @UServer + @Common + 'd:mars_syscommonscriptsodbcbcp -D CopyMedMgr10_Testing -i D:mars_sysdataupdatesccbm' + @FullFileName + ' -Q''' + @triFileName
exec(@SQL)

Fetch Next From ActiveFile
Into @Ip_FileName, @Ip_Active

End

CLOSE ActiveFile
DEALLOCATE ActiveFile

View 8 Replies View Related

Master..xp_cmdshell And SQLAgentCmdExec Permission

Jul 8, 2002

I want to run xp_cmdshell but the loging I use doesn't have sysadmin.
I thought I can just click Reset Proxy account button on Job System tab
in SQL Server Agent properties.
It's not really working.
I have SQL 2000 either, so I tried to set proxy account using xp_sqlagent_proxy_account and it works.

Is there anything like xp_sqlagent_proxy_account in SQL 7?
or does anyone know why Reset proxy account doesn't work?
It's SQL 7 on NT 4.

Thanks,

View 1 Replies View Related

SQL SERVER 2000 - EXEC Master..xp_cmdshell Permissions

Jul 20, 2005

Hi allI have a stored procedure that has the lineEXEC master..xp_cmdshell 'dtsrun /Stestjob1 /N testdts /E'If I run the SP from an access front end as a trusted user or from ascheduled job it runs fine and exectues the dts.If I run the stored procedure using VB6 as a standard connection the dtsjobwont run. I get back Execute permissions denied on xp_cmd.. on databasemasterdb_connect_string = "Provider=SQLOLEDB.1;Persist Security Info=False;UserID=test_connect;PWD=pw1test;Initial Catalog=testdb;Data Source=" &database_name....Set cmd = New ADODB.Commandcmd.ActiveConnection = db_connect_stringcmd.CommandType = adCmdStoredProccmd.CommandText = "testStoredProcedure"cmd.ExecuteDo I need to give test_connect permisions to run the test stored procedure.I hoped that because the VB called a stored procedure and the connection hadpermissions to execute the SP then it would be the SP that called thexp_command....can anyone tell me the accepted way to do thismany thanksAndy

View 2 Replies View Related

Exec Master.dbo.xp_cmdshell N'Xcopy C:@folder1 C:@folder2 /i'

Mar 7, 2008



Hi All,

I am writing a stored procedure which accepts 2 parameters -
Current version(.....for example V53)
UpgradeTo version(.....for example V61)

Using these 2 inputs --I need to create a directory V61 by copying directory V53
for this specific example it would go like this-------------

exec master.dbo.xp_cmdshell N'Xcopy c:V53 c:V61 /i'

Now if i want to make a dynamic query for this ...
how do i go about it?


declare @folder1 varchar(255)

declare @folder2 varchar(255)

declare @xcopytext varchar(255)


SET @folder1 = 'V53'

set @folder2 = 'V61'


set @xcopytext = N'Xcopy "c:@folder1" "c:@folder2" /i'

exec master.dbo.xp_cmdshell @xcopytext

This gives the error :
File Not Foundfolder1

How do I integrate dynamic query with XCopy functionality ?

View 5 Replies View Related

I've Tried Exec Master..xp_cmdshell 'bcp DBCC CHECKDB Queryout C:Test.txt'

Mar 7, 2005

Hi,
i Exected...

Exec Master..xp_cmdshell 'bcp "DBCC CHECKDB" queryout "c:Test.txt"'

i've tried through this SQL script in Query Analyser but.
the Result is not storing in the Text file, and getting output this

---------------------------------------
Password:
NULL
Do you want to save this format information in a file? [Y/n]
Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain at least one column
NULL
BCP copy out failed
NULL
----------------------------------------
Please help me, Successful Query.
Thanks <b>Nosepicker</b>
u r solutions is right...
Which u gave the Query...
Exec Master..xp_cmdshell 'osql -Uuserid -Ppassword -Sservername -ddatabase -Q"DBCC CHECKDB" > "c:Test.txt"'

i've Executed, It's work's fine in the VB6,VB.Net,ASP.Net...
I've done project, i've facility to take Backup and Restore the Database...

View 8 Replies View Related

How To Grant Execute On Xp_cmdshell??

Apr 2, 2002

Can anyone help me please.
Healp please.
Does anybody know how to make xp cmdshell runnable for users other than Admin. It should be possible to grant execute to others, but i can't figure out how.

This is what i found:

Be aware that when you grant execute permission for xp_cmdshell to users, the users will be able to execute any operating-system command at the Windows NT command shell that the account running SQL Server (typically local system) has privilege to execute.

To restrict xp_cmdshell access to users who have administrator permission on the Windows NT-based computer where SQL Server is running, use SQL Setup or SQL Enterprise Manager to set the server options, selecting the "xp_cmdshell - Impersonates Client" option. With this option selected, only users who have connected to SQL Server via a trusted connection and are members of the local Administrators group on that computer are allowed to use xp_cmdshell. The commands run by xp_cmdshell continue to execute in the server's security context.

View 1 Replies View Related

Execute Xp_cmdshell And Other SA Storedproc

Mar 8, 2004

Hi all,

I have to execute stored procedures containing
xp_cmdshell and certain system storedprocedures in msdb and master
with a user who is not SA.
(i.e iam able to execute stored procedures when i log as sa,
but any other user cannot run them)

Pls tell how to do this, it is quite urgent.

View 1 Replies View Related

Permissions For Non Sa User To Execute Xp_cmdShell

Mar 6, 2008

Hi,    I want to execute BCP in Query Analyser in SQL Server 2005 Express for that i surf on net and find that i should execute BCP under xp_cmdShell, That works good for addministritative account on SQL. But i want the working will be done by a non administrative account or non 'sa' user.How can i assign a non sa User permissions to execute xp_cmdShell? or just tell me any other alternative way to run BCP in Query Analyser or code behined. thanx 

View 1 Replies View Related

Failing To Execute Command Using Xp_CmdShell

Sep 28, 2001

Hi all,

In SQL Server using xp_cmdshell we can excute any of the command or executable files which can be executed in command prompt. Here my problem is that .. I am trying to execute OSQL from the MSSQL(Query Analyser) using xp_cmdshell.. but its give error saying "'osql' is not recognized as an internal or external command,
operable program or batch file."
This error occours when it is not able to find the executable file... but same thing I am able to execute from the command prompt. So I feel this problem is some where related to the path setting of windows. If some one can solve this problem or sugesst the how to set the path for window it will be help full..
waiting for reply

View 2 Replies View Related

Xp_cmdshell Execute Rights (2005)

Sep 11, 2006

I was trying to grant access for an application user for executing xp_cmdshell, but I got some error message saying that either doesn't the user exist, or I don't have the permissions to grant this. Does the user need to be a user in Master ? Or, don't I when logged in as "sa" have the sufficient permissions to grant execute on a SP in master?

I solved it by checking "Control server" under "Properties" > "Securables"
for the login, but I don't actually want this login to have full control.

(And yes, I've read that allowing xp_cmdshell usage isn't recommended at all.)

View 3 Replies View Related

Execute SSIS Package From SP Without Xp_cmdshell?

Nov 12, 2006

A developer needs to execute an SSIS package from a stored procedure and I do not want to enable xp_cmdshell on SQL 2005.

One suggestion is to have the application invoke dtexec on the client PC, but this would cause the package to be executed on the client and also requires some SSIS components be installed on each client.

Another idea is to configure a Windows Service to execute dtexec, but I do not know the risks of this approach. Any thoughts?

Thanks, Dave

View 1 Replies View Related

Execute SSIS Package From Xp_cmdshell?

Mar 19, 2008

How to execute SSIS package from CMD or using xp_cmdshell?
SSIS package is saved in the folder of the integration services Db.

Thanks in advance.

View 2 Replies View Related

XP_CMDSHELL With Variable

Sep 18, 2006

Hello

I want to execute the following:

DECLARE @ToolsPath AS NVARCHAR(4000)
DECLARE @location varchar(255)

EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftMicrosoft SQL Server90ToolsSetup',SQLPath',@location OUTPUT

SET @ToolsPath= '"' + @location + 'SetupBinnsqldiag.exe" -E -O c:sqldiag.txt -C'
EXEC xp_cmdshell @ToolsPath

My problem is in line EXEC xp_cmdshell @ToolsPath. It doesn't seem to accept the variable as where it works fine with the complete path

I'm sure there must be a workaround or something. What am I missing?

Thanks!

Worf

View 2 Replies View Related

Xp_cmdshell - Need To Execute External Program Asynchonous

Oct 21, 2004

hi,

i need to start an external program (vb.net) from within a trigger. via xp_cmdshell everything works fine except that the execution of the trigger waits for the vb-program to finish.

now i tried a workaround with a "starter application" which only calls the vb.net program (asynchronous) an ends.

this works fine from a dos prompt (command prompt returns immediately and vb.net task is running). but when i call the starter app from the trigger with xp_cmdshell, the behavior is the same as before: execution does not continue until the vb.net task ends.

any other ideas that could solve my problem? submitting an agent-job is not fine for me because i need to supply parameters to the called program and maybe i need call it more than once at the same time.

thanks
thomas

View 2 Replies View Related

Looking For A Way To Refer To A Package Variable Within Any Transact-SQL Code Included In Execute SQL Or Execute T-SQL Task

Apr 19, 2007

I'm looking for a way to refer to a package variable within any
Transact-SQL code included in either an Execute SQL or Execute T-SQL
task. If this can be done, I need to know the technique to use -
whether it's something similar to a parameter placeholder question
mark or something else.


FYI - I've been able to successfully execute Transact-SQL statements
within the Execute SQL task, so I don't think the Execute T-SQL task
is even necessary for this purpose.

View 5 Replies View Related

Execute Xp_cmdshell From Store Procedure (called From Aspx)

May 21, 2004

Hi, I have been searching for an answer to allow me to execute xp_cmdshell from withing store prcedure by calling the store procedure from an aspx via click on a button. This is what I found from my reserch but was not able to know where to set the rights and what each of them means:
"To run xp_cmdshell for a non-system administrator user, you must grant the following rights.
MSSQLServer and SQLServerAgent Services
Act as part of the Operating System.
Increase Quotas.
Replace a process level token.
Log on as a batch job."

The above quote was from the following link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;264155

The bottom line is to be able to call a store procedure from an aspx page to execute the code which contain xp_cmdshell command, an example of such command is like:
------------------------------------------------------------
EXEC master..xp_cmdshell 'dir d:BT_importDatasales_option_price_report.csv'

Thanks for your help
ehx5

View 1 Replies View Related

Best Method For Using FTP Command Xp_cmdshell Or Execute Process Task

Dec 8, 2005

Hi, I need to send a table data into flat and then ftp into different location.
I was using xp_cmdshell via sql task but my network engineer is saying that this xp_cmdshell will break the security and recomond to use "Execute Process Task". If i'm using this task getting the below error.
Could you advice me regrding network engineer thought and any solution for avoiding this error.


---------------------------
Execute Process Task: C:WINDOWSsystem32ftp.exe
---------------------------
CreateProcessTask 'DTSTask_DTSCreateProcessTask_1': Process returned code 2, which does not match the specified SuccessReturnCode of 0.
---------------------------
Thanks,

View 1 Replies View Related

Other Way To Execute The Xp_cmdshell Command On Remote Databases From Local?

Nov 14, 2007

Hi all,


Criteria:

We connect to the remote database servers through the network from loca by using Query Analyzer.
Previously we were able to execute the xp_cmdshell command from local Query Analyzer to fetch the remote databases data.
But now we are unable to execute the xp_cmdshell command on remote databases from local Query Analyzer
We do not know what happened but i think due to network updates this command is not able to execute...


For ex:
Previously i was able to execute master..xp_cmdshell 'net start' from local Query Analyzer.But now not able to execute


Now my question is, is there any other way(Directly or indirectly) to execute the xp_cmdshell command on remote databases from local?


Note : we are able to execute this command on remote Query Analyzer but not from local QA

Any suggestions would be very very helpful to me?


Thanks in advance,



View 6 Replies View Related

Cannot Execute Xp_cmdshell. Access Is Denied While Copying Data Over The Network

Aug 7, 2006

Hi,I am having
some trouble copying data over my workgroup network from my Windows
2003 Server Machine (machineA with SQL SERVER 2005) to one of my
network Machine's drive(MachineB).Here is the T-SQL code that I am trying to execute:EXEC xp_cmdshell 'copy D:Datafile.txt  \MachineBDocuments'Whenever
I tried to execute the above piece of code, I get the error message
"Access is denied", but if I try to copy the file from the Command
Prompt (cmd.exe) with the copy command, the file copies fine over the
network.I have already searched over the internet and I found
out that loads of people have the same issue, and they were suggested
something like this:"Check in Services and make sure that the MSSQLServer service is run as
a domain user and that domain user has rights to these network
resources."Well
it sounds plausible, but I don't know what are the exact steps to do
this. How do I know which user is running the MSSQL Server service? Are
they referring to the user which I use to connect to my SQL Server
Database engine throuhg the SQL Server Management Studio?Also they are suggesting 'domain user', and as I said before I do not have domain network just regular simple workgroup network.Here
are some details of the user that I use to login. I generally login
into my Windows 2003 Server machine with user called 'User1' and I use
the same 'User1' to connect to SQL Server through the Management Studio
Screen.Should I create a user called 'User1' on my MachineB(Destination Machine)?I would really appreciate, if someone can give me detailed steps explaning how to solve this problem.Thank you very much once again.

View 11 Replies View Related

Cannot Execute Xp_cmdshell. Access Is Denied While Copying Data Over The Network

Aug 7, 2006

Hi,

I am having some trouble copying data over my workgroup network from my Windows 2003 Server Machine (machineA with SQL SERVER 2005) to one of my network Machine's drive(MachineB).
Here is the T-SQL code that I am trying to execute:

EXEC xp_cmdshell 'copy D:Datafile.txt \MachineBDocuments'

Whenever I tried to execute the above piece of code, I get the error message "Access is denied", but if I try to copy the file from the Command Prompt (cmd.exe) with the copy command, the file copies fine over the network.

I have already searched over the internet and I found out that loads of people have the same issue, and they were suggested something like this:
"Check in Services and make sure that the MSSQLServer service is run as
a domain user and that domain user has rights to these network
resources."

Well it sounds plausible, but I don't know what are the exact steps to do this. How do I know which user is running the MSSQL Server service? Are they referring to the user which I use to connect to my SQL Server Database engine throuhg the SQL Server Management Studio?
Also they are suggesting 'domain user', and as I said before I do not have domain network just regular simple workgroup network.

Here are some details of the user that I use to login. I generally login into my Windows 2003 Server machine with user called 'User1' and I use the same 'User1' to connect to SQL Server through the Management Studio Screen.
Should I create a user called 'User1' on my MachineB(Destination Machine)?

I would really appreciate, if someone can give me detailed steps explaning how to solve this problem.

Thank you very much once again.

View 18 Replies View Related

Using XP_CmdShell To Execute BCP Utility With QUERYOUT. How To Control The OWNER Of The File Created?

Jan 29, 2008

I need the file created by my BCP QUERYOUT command I'm executing from XP_CmdShell in Transact-SQL to have a specific OWNER. I've tried using the sp_xp_cmdshell_proxy_account to setup the correct owner. The owner is always SERVERNAMEAdministrators.

thanks,

jim




View 1 Replies View Related

EXECUTE Master.dbo.xp_fixeddrives 2

Dec 13, 2002

Hi,

My production server is win2000 sql 2000 sp2.

Couple of days back when I tried to take the backup of the main database through EM (right click on database, all tasks--> backup database ), it hung at the point when I tried to select the drive for the device. However, I was able to take backup through scheduled task at that point.

Anyway, I still see the open connection (after two weeks) for that in the current activity window.
Here is the detail about the process.

'EXECUTE master.dbo.xp_fixeddrives 2'

I have read about it that it is a known sql bug since sql 7.0. But what is the solution to work around it? is it ok to kill this process? what are the possible consequences? Or how can I get rid of this SPID?

The next planned reboot for the server is 31st January. So rebooting server is not an option.

Thanks,
Shaili

View 1 Replies View Related

Creating CSV Files Using BCP &&amp; Stored Procedures:BCP Executed From T-SQL Using Xp_cmdshell-How To Declare The Scalar Variable @@

Jan 24, 2008

Hi all,

I tried to create a CSV file using Bulk Copy Program (BCP) and Stored Procedures: BCP executed from T-SQL using xp_cmdshell. I have the following sql code executed in my SQL Server Management Studio Express and error message:


--scBCPcLabResults.sql--

declare @sql varchar(8000)
select @sql = 'bcp ChDbLabResults out
c:cpChDbLabResults.txt -c -t, -T -S' + @@.SQLEXPRESS
exec master..xp_cmdshell @sql

Msg 137, Level 15, State 2, Line 3
Must declare the scalar variable "@@".

=========================================================================================
--scBCPcLabResults.sql--

declare @sql varchar(8000)
select @sql = 'bcp ChDbLabResults out
c:cpChDbLabResults.txt -c -t, -T -S' + @@SQLEXPRESS
exec master..xp_cmdshell @sql

Msg 137, Level 15, State 2, Line 3
Must declare the scalar variable "@@SQLEXPRESS".

===================================================================

I copied this set of code from a tutorial article that says "@@servername". My Sql Server is SQLEXPRESS, so I put @@.SQLEXPRESS or @@SQLEXPRESS in the code of scBCPcLabResults.sql.
I do not know why I got an error {Must declare the scalar variable "@@"} or {Must declare the scalar variable "@@SQLEXPRESS"}!!!??? Please help and advise me how to solve this problem.

Thanks in advance,
Scott Chang

View 3 Replies View Related

Execute User Stored Procedure In Master

Nov 26, 2007

I need some clarification regarding the security inside of the master db.

I have a user stored procedure in master. I would like to be able to execute that stored procedure from an internal web app. Would I give execute permission on the stored procedure to the "public" or "guest" role? The web app would be using a userid/pw for an application database.

Also, is it a good idea to have user stored procedures inside of master? Could someone point me to where I can find a good article on master db best practices?

Thanks in advance.

View 6 Replies View Related

Integration Services :: Execute Many Packages From One Master Package?

May 4, 2015

I have 12 packages to execute in order. I made a table in my DB where i mentioned the name of each package and his order in execution.

I want to create a master package that get the name and order from my DB table to execute all packages.

View 3 Replies View Related

SQL Variable And IS Variable In Execute SQL Task

Jan 3, 2007

Hi,

 

I have an Execute SQL Task (OLE DB Connnection Manager) with a SQL script in it. In this script I use several SQL variables (@my_variable). I would like to assign an IS variable ([User::My_Variable]) to one of my SQL variables on this script. Example:

 

DECLARE @my_variable int

, <several_others>

SET @my_variable = ?

<do_some_stuff>

 

Of course, I also set up the parameter mapping.

However, it seems this is not possible. Assigning a variable using a ? only seems to work in simple T-SQL statements.

I have several reasons for wanting to do this:

- the script uses several variables, several times. Not all SQL variables are assigned via IS variables.

- For reading and mainenance purposes, I prefer to pass the variable only once. Otherwise every time the script changes u need to keep track of all questionmarks and their order.

- Passing the variable once also makes it easier to design the script outside IS using Management Studio.

- This script only does preparation for the actual ETL, so I prefer to keep it in one task instead of taking it apart to several consecutive Execute SQL Tasks.

- I prefer to use the OLE DB connection manager because it's a de facto standard here.

 

Could anyone help me out with the following questions:

- Is the above possible?

- If so, how?

- If not, why not?

- If not, what would be the best way around this problem?

 

Thanx in advance,

Pipo

View 6 Replies View Related

Variable Access In Master Child Package

Dec 2, 2007



I have a master package which calls two package one after an other.

1) I will be passing parameters to master package using dtexec with /set property to set the variables in the master package. I would like to know how can child package access these variables.

View 1 Replies View Related

EXECUTE Permission Denied On Object 'sp_OACreate', Database 'master', Owner 'dbo'.

Sep 21, 2005

I want to send email using sql stored procedure.my code is work fine in my local sqlserver account. when I use my online sql server it display this error.
EXECUTE permission denied on object 'sp_OACreate', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OASetProperty', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OAMethod', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OADestroy', database 'master', owner 'dbo'.
How canI solove this problem?

View 1 Replies View Related

EXECUTE Permission Denied On Object 'sp_OACreate', Database 'master', Owner 'dbo'.

Sep 21, 2005

I want to send email using sql stored procedure.my code is work fine in my local sqlserver account. when I use my online sql server it display this error.

EXECUTE permission denied on object 'sp_OACreate', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OASetProperty', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OAMethod', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OADestroy', database 'master', owner 'dbo'.

How canI solove this problem?

View 2 Replies View Related

EXECUTE Permission Denied On Object 'xp_startmail', Database 'master', Owner 'dbo'.

Dec 7, 2007



Hi All,

I am having this issue with my application developed in VB.Net. The thing was working properly for the last couple of years. But suddenly it is giving me this error message when ever I try to execute the following code.



mycommand = New SqlCommand(sqlstr, SqlConnection1)

SqlConnection1.Open()

mycommand.ExecuteReader()



The operation is never related to sending e-mail and even the master Database, it is used just to display records on grid.

Here is the error message comeing out when it reaches the mycommand.ExecuteReader():



EXECUTE permission denied on object 'xp_startmail', database 'master', owner 'dbo'.



Any help?

Thank you,

View 5 Replies View Related

SQL 2012 :: Master / Driver Package And Expression To Set Variable

May 5, 2015

I have been using SSIS for a while now, originally in SQL 2008 but more lately SQL 2012.

I discovered the GETDATE() function in SSIS so I thought I would use this in a variable expression in a Master/Driver package with the child parameters mapped to this variable. A big mistake. The value is not persisted, it gets updated each time the variable is read, so it's back to setting the variable value using a script task in the Master/Driver package.

View 2 Replies View Related

Xp_cmdshell Does Not Execute For Non-sysadmin Account Even With Proxy Account

Mar 2, 2004

Hi all, i hope you can help me.

Basically a dts package has been setup that pulls in data from another companies server, this data requires to be on-demand i.e individual users can pull in updates of the data when they require it.

I am using xp_cmdshell and dtsrun to pull in the data. This obviouly works fine for me as i am a member of sysadmin.

Books online quotes " SQL Server Agent proxy accounts allow SQL Server users who do not belong to the sysadmin fixed server role to execute xp_cmdshell"

So i went to the SQL Server Agent Properties 'Job System' tab and unchecked 'Non-sysadmin job step proxy account' and entered a proxy account.

The proxy account has been setup as a Windows user with local administrator privilages and even a member of the sysadmin server role - just in case.

Now when i log onto the db with my test account - a non-sysadmin - and attempt to run the stored proc to import the data i recieved the message 'EXECUTE permission denied on object 'xp_cmdshell', database 'master', owner 'dbo' '

hmm... so basically i have either misunderstood BoL or there is something not quite right in my setup.

I have search the net for a few days now and yet i can find no solution.

Can anyone help?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved