Sunday, January 4, 2009

Separating batches using a new word, instead of “GO”.

Can we use a different word instead of GO? Yes, it is possible because GO is not a T-SQL statement; it is a command that is recognized as a batch separator by client tools such as Management Studio and sqlcmd. Unfortunately most are unaware of this and consider it is as a T-SQL statement. If you need to use a new word with your management studio, follow these steps; Open Options window (Tools -> Options). Expand and select the node Query Execution -> SQL Server -> General. Find an option called Batch Separator. Set a new value as you want. Done. Now you can use the new word instead of GO. You may face for a problem if you execute the code in a different Management Studio. Because of that, the word GO is preferred and recommended but remember the fact; it is not a T-SQL statement.

No comments: