I have a long SQL Script which I run to pre-populate some temp tables. At the bottom of the script, I have some queries that I run manually, as well as some other ad-hoc queries. I open the query, then get it started (takes a few minutes to run). However, I don’t want all the queries at the end of script to run – I only want to the temp tables to populate.
SQL Server 2008 Management Studio has a “breakpoint” function that will stop the script at that point, but if you close the application and re-open it, it will forget the breakpoint (only lasts for the session in which you set it).
I could comment out the queries at the bottom and run them manually. However, the ideal solution for me was to include a command in my script to stop the script from running.
In SQL Server 2008 is there a command I can put into my script that will stop processing at a specific location?
Just put a RETURN at the place where you want to stop executing the script.