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
Site Owners
Site Owners
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: Administrators
Points: 18663 Visits: 223
Comments posted to this topic are about the Question of the Day for 27 Jan 2006 posted at http://www.sqlservercentral.com/testcenter/qod.asp?QuestionID=695.
Stephen Bailey
Stephen Bailey
Old Hand
Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)

Group: General Forum Members
Points: 345 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
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34634 Visits: 13125

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/Data Platform MVP (2006-2016)
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
TDuffy
TDuffy
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2856 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 (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)

Group: General Forum Members
Points: 418 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
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10703 Visits: 2778
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