Is there a difference between ‘GO’ and ‘BEGIN…END’ in SQL Scripts/Stored Procedures? More specifically, does BEGIN…END specify batches just as GO does?
Is there a difference between GO and BEGIN…END in SQL Scripts/Stored Procedures? More specifically,
Share
GO is not actually a command understood by the server. It is simply a delimiter used by the client tool, e.g. Query Analyzer, to split the SQL up into batches. Each batch is then normally sent to the server separately. The client tool usually lets you configure the batch separator to be whatever you choose, GO is a convention.
BEGIN/END is a block marker which wraps a section of code in the same way that curly braces do in other languages.