Is that possible to run batch file (.bat) from sql server?
Thanks.
*** Sent via Developersdex http://www.examnotes.net ***DECLARE @.v_cmd VARCHAR(2000)
SET @.v_cmd = 'CALL "d:\myfolder\mybatch.bat"'
EXEC master..xp_cmdshell @.v_cmd ,NO_OUTPUT
-- OR
-- EXEC master..xp_cmdshell @.v_cmd|||I guess what I am asking is to call the bat file from a stored proc?
*** Sent via Developersdex http://www.examnotes.net ***|||Thanks.
*** Sent via Developersdex http://www.examnotes.net ***|||Test Test (farooqhs_2000@.yahoo.com) writes:
> I guess what I am asking is to call the bat file from a stored proc?
You can invoke a bat file with help of xp_cmdshell. Note that xp_cmdshell
is fairly dangerous feature, if opened to unprivileged users, since
it permits you run commands on Windows level on the SQL Server machine.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
没有评论:
发表评论