STOP! Wrong Server!

Posted by merrillaldrich on SQL Blog See other posts from SQL Blog or by merrillaldrich
Published on Fri, 26 Jul 2013 16:26:42 GMT Indexed on 2013/08/02 15:54 UTC
Read the original article Hit count: 120

Filed under:
Some time ago I wrote a post about old-time T-SQL flow control . Part of the idea was to illustrate how to make scripts abort on errors, which is surprisingly convoluted in T-SQL. Today I have a more specific example: how can I check that we are really about to execute in the right database on the right server, and halt if not. Perhaps you’ve connected to the wrong server, or the database you intend to modify doesn’t have the name your script expected. “USE database” is wonderful, but what if it...(read more)

© SQL Blog or respective owner