Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Question of the Day for 27 Jan 2006 Expand / Collapse
Author
Message
Posted Friday, January 6, 2006 8:05 PM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
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.
Post #249110
Posted Friday, January 27, 2006 5:24 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, November 10, 2011 5:55 AM
Points: 293, 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
Post #254038
Posted Friday, January 27, 2006 5:55 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 5:28 PM
Points: 5,969, Visits: 8,224

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
Post #254045
Posted Friday, January 27, 2006 8:23 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2008 12:02 PM
Points: 1,318, 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




Post #254122
Posted Friday, January 27, 2006 8:47 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, March 20, 2014 10:04 AM
Points: 402, 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!)
Post #254130
Posted Thursday, November 22, 2012 2:37 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
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/
Post #1387777
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse