Background information:
I am trying to set up a batch job for syncing stored procedures between different sql servers. I did export all stored procedures into seperate .sql files into my folder. Whenever I want to create a new stored procedure or change it for those multiple servers, I test it on 1 server until I got it the way i want it. After that I export it into my folder. To then deploy it to the other servers, I simply execute a batch - that's it.
I've almost figured out my batch the way i want. The only problematic thing is, that sqlcmd seems not to like the standard batch separator 'GO' ('Incorrect syntax near 'GO'.'
). So i've changed my default batch separator to 'RUN', replaced each 'GO' command with 'RUN' in my .sql files and added -c RUN
to my sqlcmd
command.
However it then tells me 'Incorrect syntax near 'RUN'.'
.
For testing purposes I just tried it out with 1 shrinked sql file, looking like this:
USE [MyDatabase]
GO
Even that did not work. How can I make it work?