|
Post by Amitava on Sept 9, 2015 7:39:53 GMT
Hi Guys, Recently need some sql statement which can invoked an EXE file from the specific directory. After a little bit searching I found as follows. SET @DBNameRoot = DB_NAME()
declare @cmd as varchar(250)
SET @cmd = 'C:\Automailer\AutoMailerExporter.exe S ' + CAST(@ReportID AS VARCHAR) + ' ' + @DBNameRoot
exec master..xp_cmdshell @cmd Note: - S, @reportid, @dbnameroot - All these are command line argument
- This may not work on express edition (I am not confirm, if somebody let me know please)
- You need to enable xp_cmdshell (How to do? please surf a little bit or I will post another day).
Thanks for reading, and happy coding....
|
|