Ed Wagner (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