August 7, 2008 at 9:04 am
I would like to use SQLCMD to run a large script stored locally on command. To do this, I would like to create a job with one step, in this step, I have two commands...
sqlcmd -i " \Out1";
sqlcmd -i " \Out2";
I have the Type of job as Operating system (CmdExec). Is it possible to run sqlcmd from sql server 2005? Or do I have to run it from the cmd? I would like to be able to just create a job to run the commands, but I don't know if its possible. Please advise, thanks.
-Kyle
August 7, 2008 at 9:30 am
I keep getting the error Incorrect syntax near 'i'. The label 'D' has already been declared. Label names must be unique within a query batch or stored procedure.
August 7, 2008 at 10:32 am
what does the input file contain
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
August 7, 2008 at 10:42 am
D:\MSSQL\MSSQL.1\Scripts\Test1.sql
D:\MSSQL\MSSQL.1\Scripts\Test2.sql
August 8, 2008 at 12:14 am
try this
sqlcmd -S servername -U username -P password -i "D:\MSSQL\MSSQL.1\Scripts\Test1.sql"
sqlcmd -S servername -U username -P password -i "D:\MSSQL\MSSQL.1\Scripts\Test2.sql"
you have to run these from cmdexe. If you want to schedule it, put these commands in a batch file and shedule execution of batch file.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply