I am running sql server 2008 express and i need to schedule some stored procedures to run nightly…so i have built out these .sql files which i would want to run from .bat file…i need to know the command to execute these .sql files one by one and store their results i guess…can anyone help me out?
Share
I answered this in this other question:
You should invoke the sqlcmd command-line tool from your batch file. Assuming your sql file is “backup.sql”, the command line would be something like:
-Euses trusted connection, replace with-Uand-Pif you need to specify a SQL username and password. See also this article with examples.