Tuesday, 30 June 2009

Running a stored procedure from a batch file

Running a stored procedure from a batch file >

Example given is sending an email, put this all on one line....

osql -E -d databasename -S servername -Q " EXEC msdb.dbo.sp_send_dbmail @profile_name='Mail Profile', @recipients='name@domain.com', @body='Task Complete', @subject='Task Complete', @importance='High' "


could use the -o parameter to pipe output to a file if necessary, e.g. -o c:\output.txt

No comments: