I want to alter like 10 stored procedures, each of one I got the script for. I want to put these Alter SP scripts in one single SQL Server script file and run it all at once. I copied all the alter SP scripts in one single file but it didn't work : says Alter Table statement should be the first one ..blah blah
How do I create a single script that will run ALL the Alter scripts at once?
Create an SQL file in that writes Go
after each procedure.
Your file structure will be like as below :
stored procedure 1
Go
stored procedure 1\2
Go
...
stored procedure n
Go
You can concatenate your script files as Pranay Rana suggests.
But if you're using SQLCMD.EXE, it may be easier just to include existing files with the ":r" command:
:r File1.sql
:r File2.sql
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.