SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question of the Day for 27 Jan 2006


Question of the Day for 27 Jan 2006

Author
Message
Stephen Bailey
Stephen Bailey
Old Hand
Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)Old Hand (305 reputation)

Group: General Forum Members
Points: 305 Visits: 34
The semicolon is not a batch separator, it is the end of statement character. However, it is not required because the SQL language is specified using Bacus-Naur Form or BNF.

It is possible when parsing a statement or batch to examine the current statement token and the next statement token, compare them against the BNF definition of the language and determine whether the end of statement has been reached or not without the use of the semi-colon.

The only batch separator in SQL 2000 is the GO statement which as it happens is not part of the SQL language.

Stephen Bailey
Hugo Kornelis
Hugo Kornelis
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11148 Visits: 12004

Stephen is correct. The semicolon is a command seperator; GO is a batch seperator.

Though the semicolon is completely optional in SQL Server 2000, this changes in SQL Server 2005. In some cases (especially before a CTE), using a semicolon is required.

Best, Hugo




Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
TDuffy
TDuffy
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1462 Visits: 57

Don't the 100+ ppl who go this wrong have access to Query Analyzer? A cut/paste/execution lasting 5 seconds and you have the answer.

No offense meant!

Terry





Tom Erwine
Tom Erwine
SSC-Addicted
SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)SSC-Addicted (412 reputation)

Group: General Forum Members
Points: 412 Visits: 11
I am sure they do... But that defeats the purpose of seeing if you know the answer just by reading it. I don't look it up in the BOL's first either. More fun to guess since my job does not depend on me getting all the answers correct (Thank God!)
kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3119 Visits: 2766
i dont think this question is worth of 2 points..
explanation is also wrong..
GO is a batch seperator while semi-colon is a command seperator

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search