Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

SQL Job ExecCMD spans multiple lines

$
0
0

We currently have following code run as a T-SQL step in a SQL jon

UPDATE Table1
SET Col1 = <somevalue>
SET Col2 = <somevalue>
SET Col3 = <somevalue>
WHERE Col4 = <somevalue>

We moved Table1 to a DB on a remote server and to minimize impact we wanted to change the Jobstep type to CmdExec and replace the code by:

SQLCMD -E -SRemoteServer -dRemoteDB -Q
"
UPDATE Table1
SET Col1 = <somevalue>
SET Col2 = <somevalue>
SET Col3 = <somevalue>
WHERE Col4 = <somevalue>
"

But this doesn't work.

Adding a ^ at the end of each line to indicate the command continues on the next line works well in a cmd prompt, but is ignored within a SQL Jobstep.

Anyone an idea?

Thanks


Geert Vanhove DCOD ------ http://geertvanhove.wordpress.com/ ----------- Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!


Viewing all articles
Browse latest Browse all 15694

Trending Articles