February 28, 2007 at 8:24 am
I am looking to start a batch file from Transact SQL in Query analyzer and ultimately in a job does anybody have code that does this? Or can it be done?
February 28, 2007 at 8:28 am
Did you try master..xp_cmdshell?
February 28, 2007 at 8:55 am
Please provide an example -- I tried using it but I think I am using it incorrectly.
February 28, 2007 at 8:09 pm
Read this in the forum: http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=347999
February 28, 2007 at 8:20 pm
What kind of error are you getting... you might also post your code so we can help more. And, don't forget, you must have "SA" privs to use it.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 1, 2007 at 6:47 am
Assume you have a batch file called TEST.CMD located in C:\ on your server that contains this code:
@echo off
echo This is TEST.CMD
pause
To run this from Query Analyzer using integrated security, you could execute this:
exec master..xp_cmdshell '"c:\test.cmd"'
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply