October 30, 2013 at 10:57 am
We have the following in a bat file:
REM This BAT file uses the userid and password of the account that is running the BAT file.
REM %1 = SQLServer name
REM %2 = database
REM %3 = path to .sql and .log files folder
REM %4 = file name w/o the file extension for .sql and .log files
osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b
We have another version that requires username and password.
In SSIS we send the 'varaiables' this needs in the Arguments part of the execute process task and the Executable portion points to this bat file.
Let me know if you need more than this.
-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Don't fear failure, fear regret.
October 30, 2013 at 1:25 pm
below86 (10/30/2013)
...osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b
...
Just for your information:
osql is deprecated (and it has some issues. I remember it not working with utf8 files are something like that.)
You can replace it with sqlcmd.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 30, 2013 at 1:33 pm
Koen Verbeeck (10/30/2013)
below86 (10/30/2013)
...osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b
...
Just for your information:
osql is deprecated (and it has some issues. I remember it not working with utf8 files are something like that.)
You can replace it with sqlcmd.
Thanks for the info, I'll keep it in mind if we start to see issues.
-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Don't fear failure, fear regret.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply