October 10, 2011 at 12:27 pm
This is probably one of those basic questions that I tend to forgot.
What is the difference between GO and ;
SELECT * FROM WishIWasAtSqlpass;
SELECT * FROM IAmAtWork;
vs
SELECT * FROM WishIWasAtSqlpass
GO
SELECT * FROM IAmAtWork
GO
October 10, 2011 at 12:33 pm
Here is a thread where that topic was discussed
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
October 10, 2011 at 12:43 pm
The semicolon is a statement terminator and can actually have an affect in terms of compilability of code (specifically with reference to Common Table Expressions), and is listed as "will be required in a future version of SQL Server" by Microsoft.
"GO" is a batch separator, and doesn't actually even get sent to the server. It's just a local command in Management Studio, and you can actually change it from GO to something else if you want to, in the Tools, Options settings in SSMS. That's why it has to be on a line by itself (with the exception of a number being allowed if you want a batch run multiple times.)
They do similar things in a few instances, but don't have the same function at all as far as SQL Server is concerned.
Try using GO inside a dynamic SQL statement. You'll get an error, which you won't with a semicolon.
Try using a semicolon before a Create Table statement. You'll get an error, which you won't with a batch separator.
Same for a semicolon followed by a number, which will give an error. But a batch separator will run the preceeding batch X times.
Example:
PRINT 'X'
GO 100
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
October 10, 2011 at 1:46 pm
btw get used on using the statement terminator ';' because it will become mandatory in one of the next versions !
That will save you time fixing it later on π
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution π
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
October 11, 2011 at 5:23 am
I believe β;β is an ANSI SQL statement terminator which you can use with other RDBMS as well. The same is not true with βGOβ as its Microsoftβs own implementation for batch termination (itβs also customizable, as per previous posts)
October 11, 2011 at 6:27 am
Dev @ +91 973 913 6683 (10/11/2011)
I believe β;β is an ANSI SQL statement terminator which you can use with other RDBMS as well.
Oracle uses it too
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" π
October 17, 2011 at 3:19 am
Perry Whittle (10/11/2011)
Dev @ +91 973 913 6683 (10/11/2011)
I believe β;β is an ANSI SQL statement terminator which you can use with other RDBMS as well.Oracle uses it too
Since when is Oracle a good reference π
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution π
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
October 17, 2011 at 3:35 am
Since when is Oracle a good reference π
I am sorry but are you talking about this Oracle :hehe:
In Classical Antiquity, an oracle was a person or agency considered to be a source of wise counsel or prophetic opinion, predictions or precognition of the future, inspired by the gods. As such it is a form of divination. (Courtesy: Wikipedia)
October 17, 2011 at 5:52 am
ALZDBA (10/17/2011)
Perry Whittle (10/11/2011)
Dev @ +91 973 913 6683 (10/11/2011)
I believe β;β is an ANSI SQL statement terminator which you can use with other RDBMS as well.Oracle uses it too
Since when is Oracle a good reference π
Dude, i dont want to get into one of your product fanboy wars π
I merely pointed out that Oracle, which incidentally is one of the largest established RDBMS providers, uses this too π
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" π
October 17, 2011 at 6:55 am
Perry Whittle (10/17/2011)
ALZDBA (10/17/2011)
Perry Whittle (10/11/2011)
Dev @ +91 973 913 6683 (10/11/2011)
I believe β;β is an ANSI SQL statement terminator which you can use with other RDBMS as well.Oracle uses it too
Since when is Oracle a good reference π
Dude, i dont want to get into one of your product fanboy wars π
I merely pointed out that Oracle, which incidentally is one of the largest established RDBMS providers, uses this too π
No worries, Perry. Just throwing a stick in the hen house. That's why I added the π icon.
As many of us, I also have some responsibilities in that area :hehe:
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution π
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
October 17, 2011 at 11:11 am
ANSI standard ; terminator came from some flavors of Fortran as well as SAS (r)
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply