Solved

SQL Job error on SQL 2008

Posted on 2013-06-20
2
660 Views
Last Modified: 2013-06-21
Hello All,
I have a storeprocedure which I have created as a sql job and the job writes into a text file.
The code that does it in the SP are as follows:
declare @cmdLineString varchar(1000)

SET @cmdLineString = 'sqlcmd -d Fwreports  -q "select * from  facilities" -U sa -P Dr0fnarc -o "C:\output.txt"'

EXEC master..xp_cmdshell @cmdLineString

Open in new window


But when the job is run it gives the following error:

The job failed.  The Job was invoked by User sa.  The last step to run was step 1 (Virtua EMR PerDiem).,00:00:00,0,0,,,,0
06/20/2013 12:52:23,Virtua EMR PerDiem,Error,1,NJ0DB1\XXXFW,Virtua EMR PerDiem,Virtua EMR PerDiem,,Executed as user: NT AUTHORITY\SYSTEM. SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure.

Please help me resolve this.is there any command that I need to call before I run the xpcmd shell command to write to the file.I do not want to configure on the DB level because of security reasons.Can I implement in the SP itself.
Thanks All.
0
Comment
Question by:Star79
2 Comments
 
LVL 8

Accepted Solution

by:
didnthaveaname earned 250 total points
Comment Utility
I deleted my last post because I am evidently incapable of reading a question completely through =P  You could use the powershell subsystem if you're on 2008 - just set up a minimally privileged credential and assign it as a proxy for the powershell subsystem
0
 
LVL 25

Assisted Solution

by:jogos
jogos earned 250 total points
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sql server lock cursor 13 39
optimize  c# code 7 48
sql statement to select and drop 13 31
SQL Server RDS clr assembly 4 33
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now