December 29, 2008 at 6:59 pm
Christian Buettner (12/29/2008)
RBarryYoung (12/28/2008)
Christian Buettner (12/28/2008)
I might be nitpicking here again, but the semicolon is required after the preceding statement, not before the WITH statement.
Of course the end result is a semicolon between the two statements, but I want to emphasize again that the semicolon ENDs a statement and does not START a statement.
Ah, and can you describe what the difference is between these two things?
๐
I am not sure what your intention is here, but the difference is where the terminator is located.
And the problem with your claim that semicolon is a statement terminator is that it does not matter whether the ";" is immediately at the end of the preceding statement or immediately at the beginning of the succeeding statement. Or anywhere in the whitespace in-between. And that's the definition of a statement separator, rather than a terminator or an initiator.
Just like you end questions with a questionmark. Or would you start sentences after a question with a question mark like this
?Looks odd, doesn't it ?
Yes it does, but that is because that is invalid in the language that you are using (English). And it is invalid in English because "?" is an actual sentence terminator. On the other hand, this:;WITH ...
is perfectly valid in the language that I am using (SQL). And again, this is because the semicolon is really a statement separator.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 29, 2008 at 7:21 pm
Christian Buettner (12/29/2008)
Hi RBarryYoung,Why do you think it is not a statement terminator?
I think that it is not a statement terminator because it does not meet the definition of a statement terminator. And I am basing that on your definition of a statement terminator (above).
;
Transact-SQL statement terminator.Although the semicolon is not required for most statements in this version of SQL Server, it will be required in a future version.
http://msdn.microsoft.com/en-us/library/ms177563.aspx
SQL statements also include the semicolon (";") statement terminator. Though not required on every platform, it is defined as a standard part of the SQL grammar
Yes, Microsoft, Wikipedia and lots of other places call it a terminator. The problem is that it does not meet the definition of a terminator that most people would agree to. And this is exactly why I said that the semicolon is called a statement terminator but it is actually a statement separator.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 29, 2008 at 9:00 pm
Chris Harshman (12/29/2008)
I think it's probably good practice to follow trends that are closer to the SQL standard than the local flavors that each vendor supports
Heh... even though close to a million people are doing it wrong, it's still wrong. ๐
--Jeff Moden
Change is inevitable... Change for the better is not.
December 30, 2008 at 2:26 am
As far as I know the only case that I needed to use semicolon to terminate the statement is when I used GO as the procedure name
create procedure go
as
select 45 as number
Now this wont work
GO
but this
GO;
Here is Fun with GO
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/09/05/fun-with-go.aspx
Failing to plan is Planning to fail
December 30, 2008 at 2:38 am
If you change the connections default batch separator token from it's default 'GO' to something else, then (without ending semicolon)...
GO
.. will indeed work.
/Kenneth
December 30, 2008 at 6:42 am
Cute trick, Madhivanan. Of course "[GO]" and "EXEC GO" would also work, but I like this.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 30, 2008 at 6:50 am
RBarryYoung (12/30/2008)
Cute trick, Madhivanan. Of course "[GO]" and "EXEC GO" would also work, but I like this.
Thanks for the feedback ๐
Failing to plan is Planning to fail
December 30, 2008 at 5:47 pm
RBarryYoung (12/29/2008)
Yes, Microsoft, Wikipedia and lots of other places call it a terminator. The problem is that it does not meet the definition of a terminator that most people would agree to. And this is exactly why I said that the semicolon is called a statement terminator but it is actually a statement separator.
Is your concern that it is not correctly implemented as a statement terminator in SQL Server?
The MSDN link gives the info that It will be required for all statements in the future.
So I agree that we are somehow in grey area right now with the current implementation, but according to the documentation in BOL (the link), the semicolon should really be a statement terminator, not just a separator.
The difference according to my tiny theoretical knowledge is that
a) you separate two or more statements with separators. (A;B;C)
b) terminators end all statements, including the last statement or single statements. (A;B;C;)
Let me know if this does not match your definition.
Just as a sidenote - BOL 2005 mentions the semicolon as an "optional" statement terminator.
Best Regards,
Chris Bรผttner
December 30, 2008 at 6:00 pm
BWA-HAA! See why I hate the damned things? You guys are still going on about punctuation marks... :P:hehe:
--Jeff Moden
Change is inevitable... Change for the better is not.
December 30, 2008 at 6:05 pm
Christian Buettner (12/30/2008)
The difference according to my tiny theoretical knowledge is thata) you separate two or more statements with separators. (A;B;C;)
b) terminators end all statements, including the last statement or single statements. (A;B;C;)
Let me know if this does not match your definition.
Ah, but now you've changed your definitions to suit your argument, and that's not really cricket, is it?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 30, 2008 at 6:14 pm
Jeff Moden (12/30/2008)
BWA-HAA! See why I hate the damned things? You guys are still going on about punctuation marks... :P:hehe:
Well, you started all this
!:P
No, point taken, this discussion leads to no important benefit.
The time of the statement terminator will come (or might it might disappear, how knows). Until then I'll just agree that we disagree ๐
Best Regards,
Chris Bรผttner
December 30, 2008 at 6:22 pm
RBarryYoung (12/30/2008)
Christian Buettner (12/30/2008)
The difference according to my tiny theoretical knowledge is thata) you separate two or more statements with separators. (A;B;C;)
b) terminators end all statements, including the last statement or single statements. (A;B;C;)
Let me know if this does not match your definition.
Ah, but now you've changed your definitions to suit your argument, and that's not really cricket, is it?
Hm, I must be missing something important here. Where did I define the statement terminator?
Please quote.
Thanks!
Best Regards,
Chris Bรผttner
December 30, 2008 at 6:22 pm
Heh... wha? Moi? Oh... you mean I started it all with my "statement prefix"? ๐
--Jeff Moden
Change is inevitable... Change for the better is not.
December 31, 2008 at 7:22 am
:Wow: Can't we just all get along??? Personally I think there are things worse than semicolons in SQL, but I'm not going to get into them here. ๐
December 31, 2008 at 7:28 am
Chris Harshman (12/31/2008)
:Wow: Can't we just all get along??? Personally I think there are things worse than semicolons in SQL, but I'm not going to get into them here. ๐
Sure we can[font="Arial Black"]; [/font]If you want... ๐
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 15 posts - 31 through 45 (of 49 total)
You must be logged in to reply to this topic. Login to reply