Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute stored procedure from batch file

How would you execute a stored procedure in SQL Server (using windows authentication) from a batch file?

like image 413
Nitrodbz Avatar asked Oct 19 '12 18:10

Nitrodbz


1 Answers

If you are using Sql Server 2005+, you can use sqlcmd utility.

Example:

sqlcmd -Q "exec storedProcName" -S YourServer -d YourDatabase -o C:\yourOutput.txt

like image 51
dugas Avatar answered Oct 10 '22 05:10

dugas