October 22, 2014 at 5:31 am
Toreador (10/22/2014)
Sean Lange (10/21/2014)
A cte does NOT require it to start with a semicolon. The semicolon is statement terminator not a statement beginninator (nod to Lynn Pettis for that phrase). A cte, just like THROW, requires that the previous statement be terminated with a semicolon....
You should start. It is the ANSI standard and at some point sql server will require it. Notice that all the new features already require it usage.
+1 to all this!
Sean's right. A semicolon in a terminator. Lynn and Sean, my compliments on the begininator phrase. 😉
As for not using semicolons, click http://msdn.microsoft.com/en-us/library/ms143729.aspx and search for the phrase semicolon. It will be required in the future, at which point many people will become very busy for a very long time.
October 22, 2014 at 6:58 am
Ed Wagner (10/22/2014)
Toreador (10/22/2014)
Sean Lange (10/21/2014)
A cte does NOT require it to start with a semicolon. The semicolon is statement terminator not a statement beginninator (nod to Lynn Pettis for that phrase). A cte, just like THROW, requires that the previous statement be terminated with a semicolon....
You should start. It is the ANSI standard and at some point sql server will require it. Notice that all the new features already require it usage.
+1 to all this!
Sean's right. A semicolon in a terminator. Lynn and Sean, my compliments on the begininator phrase. 😉
As for not using semicolons, click http://msdn.microsoft.com/en-us/library/ms143729.aspx and search for the phrase semicolon. It will be required in the future, at which point many people will become very busy for a very long time.
Thank you for a very good question!
I learned something today - including the comments on semicolons! I came to T-SQL from SAS programming, where semicolon errors count for more than 75 % of all code-errors (is my experience). I truely loved T-SQL for not being such a pedantic 🙂 and I must say, they hurt my eyes..
However, it seems to be a good idea to revert this thinking of mine...:-P
October 22, 2014 at 7:03 am
Wow, the power of a semicolon. I don't use them in my sql. But I don't create stand alone selects without a FROM. But it gives me something to watch out for. Thanks for the learning experience.
October 24, 2014 at 7:41 am
Ed Wagner (10/22/2014)
Toreador (10/22/2014)
Sean Lange (10/21/2014)
A cte does NOT require it to start with a semicolon. The semicolon is statement terminator not a statement beginninator (nod to Lynn Pettis for that phrase). A cte, just like THROW, requires that the previous statement be terminated with a semicolon....
You should start. It is the ANSI standard and at some point sql server will require it. Notice that all the new features already require it usage.
+1 to all this!
Sean's right. A semicolon in a terminator. Lynn and Sean, my compliments on the begininator phrase. 😉
As for not using semicolons, click http://msdn.microsoft.com/en-us/library/ms143729.aspx and search for the phrase semicolon. It will be required in the future, at which point many people will become very busy for a very long time.
+1
Thank you, Sean, for an excellent question.
October 27, 2014 at 12:34 am
emil.bialobrzeski (10/21/2014)
This example has been tested on SQL Server 2012 and will not work on 2008 R2 or earlier
Actually this script WILL work on sql server 2008 because THROW is not a statement here
+1
I could execute this successfully on 2008 R2
sean, Thanks for the question and nice explanation
January 30, 2015 at 2:40 pm
+1; interesting explanation regarding the semi colon. I learned something today.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply