Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 26, 2012 07:40 AM by r2007
Nov 25, 2012 10:51 PM|LINK
Hello, I want to use multiple SQL statements in my migrations. When I try to use the GO keyword, it shows syntax errors, as I believe this is not a word that works outside of SQL Server Management Studio. How can I write multiple statements, like a batch
of stored procedures, through the Sql(); method in my Up and Down methods. When I run Update-Database I want all my statements to run.
Nov 26, 2012 03:15 AM|LINK
Nov 26, 2012 06:42 AM|LINK
You can also try to use Stored Procdure to escapulate them together to call the SP directly.
Nov 26, 2012 07:40 AM|LINK
The only way I have found to separate the statements was to use a form like:
EXEC sp_executesql N'
--SQL Statement 1
--SQL Statement n
This was the only way I found to do it, to have my SQL in a string executed by SQL.