﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Subramanyam Krishnamurthy / Article Discussions / Article Discussions by Author  / The Dodgy GO Statement / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 01:22:05 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>Suppose I want to eg. create a view part way through my stored proc.  SQL Server will tell me "'CREATE VIEW' must be the first statement in a query batch."  In a plain SQL I'd just throw in a GO to terminate the batch before the CREATE VIEW and start a new one.Seems to me that's a reason for wanting to be able to use GO in a stored proc.  Anyone know what to do about this?</description><pubDate>Fri, 04 Sep 2009 09:00:05 GMT</pubDate><dc:creator>karl.brazier</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>I don't know why people post such a bad article, It is waste of time and confuse the new people learning the technology. I request the authour to withdraw this article immediately.&lt;img src='images/emotions/cry.gif' height='20' width='20' border='0' title='Cry' align='absmiddle'&gt;</description><pubDate>Thu, 23 Feb 2006 13:42:00 GMT</pubDate><dc:creator>reddy-296904</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>cneuhold,Thanks for clarifying.  It really seems to me that the T-SQL language is not mature and can't match other compiled languages or PL/SQL.</description><pubDate>Wed, 22 Feb 2006 08:55:00 GMT</pubDate><dc:creator>Peter Kryszak</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;Of Course you do -- If you are going to script in multiple SPs in the same .SQL file. Also if you are going to script in a SP and a grant it some default permissions in the same .SQL file. Also if are going to create an SP and say 'print' out some status messages in the same .SQL file.&lt;/P&gt;&lt;P&gt;We have faced issues issues like this in our system (using VB and SQL2000, with all business logic implemented as SPs). The author is not saying the GO executes anything in the SP, but how a misplaced GO introduces unintentional behaviour into your SP.&lt;/P&gt;&lt;P&gt;M.&lt;/P&gt;</description><pubDate>Wed, 22 Feb 2006 03:44:00 GMT</pubDate><dc:creator>Manoj Mathew</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>hi, the behavior you experience is absolutely by design and no mystery. if you take a close look at BOL, you'll recognize that stored procedures NEVER required BEGIN and END statements. this is just a strange habit that some people seem to have. a stored procedure always starts with CREATE PROC and ends with GO (and that's the reason why it has to be the only statement in a batch).</description><pubDate>Wed, 22 Feb 2006 01:35:00 GMT</pubDate><dc:creator>cneuhold</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;All you have to do is check out Books Online&lt;/P&gt;&lt;H1&gt;&lt;A name=_go&gt;&lt;/A&gt;GO&lt;/H1&gt;&lt;P&gt;Signals the end of a batch of Transact-SQL statements &lt;FONT color=#dd1111&gt;to the Microsoft® SQL Server™ utilities&lt;/FONT&gt;.&lt;/P&gt;&lt;H5&gt;Syntax&lt;/H5&gt;&lt;P&gt;GO&lt;/P&gt;&lt;H5&gt;Remarks&lt;/H5&gt;&lt;P&gt;&lt;FONT color=#dd1111&gt;GO is not a Transact-SQL statement&lt;/FONT&gt;; it is a command recognized by the &lt;B&gt;osql&lt;/B&gt; and &lt;B&gt;isql&lt;/B&gt; utilities and SQL Query Analyzer.&lt;/P&gt;&lt;P&gt;SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to SQL Server. &lt;FONT color=#dd1111&gt;The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO&lt;/FONT&gt;. SQL Query Analyzer and the &lt;B&gt;osql&lt;/B&gt; and &lt;B&gt;isql&lt;/B&gt; command prompt utilities implement GO differently.&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 22:10:00 GMT</pubDate><dc:creator>Sean Nolan-296153</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;I work in IST time zone. Now I am back to work.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;The intention in the article is clear, to highlight the unknown error/issues and its outcome with absence/usage of GO statement. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Thanks guys for your valuable posts.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Cheers,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Krishnamurthy&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 21:20:00 GMT</pubDate><dc:creator>Subramanyam Krishnamurthy</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;A couple of points, just to confirm that GO isn't TSQL but a terminator used by DMO and SMO to parse batches of SQL. Whats more with SQLCMD you can put a number after the GO for the preceeding TSQL batch to be repeated.&lt;/P&gt;&lt;P&gt;The biggest issue I have seen is the deployment of sprocs. The easiest way is to concatenate all the files for the store procs together and run that combined file. However if one file doesn't have a go at the end and all the files start with a if exists drop statement you can end up with.&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;If exists (select 1 ....)&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;drop proc myfirstProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;create proc myfirstProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;--&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;do some stuff&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt; &lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;If exists (select 1 ....)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;drop proc mysecondProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;create proc mysecondProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;-- Do some stuff&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;go&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;If exists (select 1 ....)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;drop proc mythirdProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;create proc mythirdProc&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;-- Do some stuff&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;    &lt;/SPAN&gt;end&lt;/FONT&gt;&lt;/SPAN&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;P&gt;What you find is that this is likely to run in, however the first time someone runs myFirstProc it will drop mysecondProc &lt;img src='images/emotions/sad.gif' height='20' width='20' border='0' title='Sad' align='absmiddle'&gt; Not good.&lt;/P&gt;&lt;P&gt;On final note for those running scripts on SQL 2005 its a must that you start the script with :on error exit. This will avoid the problem detailed above, where one statement fails and but all the others are still run&lt;/P&gt;&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 15:20:00 GMT</pubDate><dc:creator>Simon Sabin</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>Yes,  you mentioned that it's not a real Transact-SQL statement.  I was expanding on what you said it "isn't" by explaining what it actually "is".As JT noted above, a discussion of how the QA "GO" batch terminator affects scope would be a nice addition to this article.Another nice addition would be the effect that "GO" has on scripts passed to SQL Server via other methods (such as .NET's SqlCommand).And to answer the author's question (just in case it wasn't fully evident in the other posts):&lt;i&gt;Q:  "...I don't understand why they allowed any executable statements after the end of stored procedure?"A:  "Because the statements after QA's 'GO' are a different batch."&lt;/i&gt;Personally I think the author picked a good subject, but there are a lot of aspects he skipped over that would have made the article a lot more informative.</description><pubDate>Tue, 21 Feb 2006 09:36:00 GMT</pubDate><dc:creator>Mike C</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;Wow, tough crowd today.  Must be a Monday thing since yesterday was a day off for many folks.&lt;/P&gt;&lt;P&gt;I use GO all the time in scripts, especially migration scripts as they have a mix of functions, stored procs, and SQL statements including drop and create statements many of which must be at the start of a batch.  Knowing where to put the GOs in the script make all the difference.&lt;/P&gt;&lt;P&gt;One thing about GO that wasn't apparant to me when I first started TSQL was that you couldn't use a local variable that was declared "across a GO".  For instance this script gives you an error:&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;DECLARE @myvar varchar(100)GO&lt;/P&gt;&lt;P&gt;SET @myvar = 'Bob was here!'SELECT @myvar&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;In such a short script it's easy to fix, but in larger scripts that need to process in a specific order, this limitation may require using temporary tables or other objects to hold values from one batch to the next.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 09:21:00 GMT</pubDate><dc:creator>JT Lovell</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;Colin, thanks for the backup.That was exactly my point: You can live without GO as far as creating Stored Procedures are concerned (this being the point discussed in the article)</description><pubDate>Tue, 21 Feb 2006 09:06:00 GMT</pubDate><dc:creator>sheepoo</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;No, you're not missing anything. You don't have to use the GO word when creating stored procs. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 09:04:00 GMT</pubDate><dc:creator>colin naylor</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>I am having real trouble understanding where I would use this 'approach' in real-world scenarios. In my experience with SQL Server (almost 2 years now) I have not come across one situation where the GO keyword caused me trouble. I use the SQLIDE Pro from Imceda/QUEST and the only time it uses the GO keyword is to do&lt;code&gt;SET QUOTED_IDENTIFIER ONGOSET ANSI_NULLS ONGO&lt;/code&gt;at the start and &lt;code&gt;GOSET QUOTED_IDENTIFIER OFFGOSET ANSI_NULLS ON GO&lt;/code&gt;at the end: I never had to use the GO keyword within a stored procedure. Maybe I am missing something here &lt;img src='images/emotions/sad.gif' height='20' width='20' border='0' title='Sad' align='absmiddle'&gt;</description><pubDate>Tue, 21 Feb 2006 08:59:00 GMT</pubDate><dc:creator>sheepoo</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;I think I already said that GO wasn't a real sql statement in my earlier message.&lt;/P&gt;&lt;P&gt;Are we surprised that we haven't heard from the author?&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 07:37:00 GMT</pubDate><dc:creator>colin naylor</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>"GO" is not a real SQL statement.  It's a batch termination indicator for Query Analyzer.   You might want to point out that trying to use "GO" in your scripts outside of Query Analyzer (like in a .NET SqlCommand), you can expect to catch some exceptions. </description><pubDate>Tue, 21 Feb 2006 07:24:00 GMT</pubDate><dc:creator>Mike C</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>I wonder if some of the confusion is from people transitioning from Oracle PL/SQL and other compiled languages where the language is much more sophisticated and clear.  CREATE/BEGIN/END have clear syntactical and semantic roles in PL/SQL.  In fact, the END statement includes the name of the procedure or function that is being defined.SUB/END SUB and FUNCTION/END FUNCTION in VB.NET are also very clear.T-SQL still seems like a toy language compared to others for this and some other reasons.--Peter</description><pubDate>Tue, 21 Feb 2006 06:41:00 GMT</pubDate><dc:creator>Peter Kryszak</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;With you there.  There's more to GO than meets the eye, and it doesn't even have to be "GO" either!&lt;/P&gt;&lt;P&gt;Thort it might be fun to share this early tale of GO horror (I was a lot younger then):&lt;/P&gt;&lt;P&gt;SQL 7, asked to implement a script from a (VB) developer to add a column to a table on a remote, client mission-critical, really, really, really important customer address db.  &lt;/P&gt;&lt;P&gt;So, did I double-check the code?  No.  &lt;/P&gt;&lt;P&gt;Did I test it on a local db?  No.  &lt;/P&gt;&lt;P&gt;Can you see a disaster coming?  Oh, yes...&lt;/P&gt;&lt;P&gt;Run the script.  See the script run.  See the error.&lt;/P&gt;&lt;P&gt;Turns out VB Fly Boy had scripted the change from Enterprise Mangler and it went something like this:&lt;/P&gt;&lt;P&gt;SELECT * INTO newtable FROM oldtable&lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;DROP TABLE oldtable&lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;CREATE TABLE oldtable (with shiny new column)&lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;INSERT oldtable SELECT * FROM newtable&lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;Okey-dokey, except the first SELECT INTO failed.  But, thanks to the joys of "GO" the script ploughed on, dropped the table etc.  So, ended up with the new table with its new column &lt;EM&gt;and no data&lt;/EM&gt;!&lt;/P&gt;&lt;P&gt;Oops.  Well, that'd be ok 'cos the local dba on the ground will have a back up.  Well, yes, &lt;EM&gt;from 3 months ago&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Lots and lots of lessons learned there.  I now spend my days doing macrame.&lt;img src='images/emotions/whistling.gif' height='20' width='20' title='Whistling' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 06:30:00 GMT</pubDate><dc:creator>Fattman</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;&lt;EM&gt;Do you really understand what happens when you create a stored procedure?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Interesting question!  I agree with the above poster.  The BEGIN and END statements are nothing to do with stored procedures but are simply used to logically group statements in IF's/ELSE's, WHILE's and CASES's.&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 02:00:00 GMT</pubDate><dc:creator>Alan Harley</dc:creator></item><item><title>RE: The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>&lt;P&gt;The author seems to think that begin and end statements seem to do something in stored procedures where they do not.&lt;/P&gt;&lt;P&gt;You can put a begin and end statement around whatever you like, but it wont stop the batch from continuing on to what comes next.&lt;/P&gt;&lt;P&gt;You also don't even need a GO statement in order to create a stored procedure. The authors seems to have totally missed the purpose of the GO statement.&lt;/P&gt;&lt;P&gt;Did you know, that SQL Server doesn't even understand a GO statement. It is not transact SQL!&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description><pubDate>Tue, 21 Feb 2006 00:10:00 GMT</pubDate><dc:creator>colin naylor</dc:creator></item><item><title>The Dodgy GO Statement</title><link>http://www.sqlservercentral.com/Forums/Topic254975-281-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF="http://www.sqlservercentral.com/columnists/sKrishnamurthy/thedodgygostatement.asp"&gt;http://www.sqlservercentral.com/columnists/sKrishnamurthy/thedodgygostatement.asp&lt;/A&gt;</description><pubDate>Wed, 01 Feb 2006 09:16:00 GMT</pubDate><dc:creator>Subramanyam Krishnamurthy-120784</dc:creator></item></channel></rss>