SQLServerCentral Editorial

Will Terminators Be Required?

,

I was looking at an article the other day and noticed that there was a CTE sample with the semicolon on the line before the code. I've been seeing this convention for years, starting your CTE with a semicolon because people aren't sure this will get dropped in a batch with other code. It's not that the CTE needs this, but the previous statement needs to be terminated. There are a few other T-SQL constructs that require any previous statements to be terminated, and as a result, we have a series of strange publishing conventions for sample code. 

I really wish that the language designers had thought this through and stopped trying to overload and reuse keywords. We could have avoided this with a simple CTE language element to indicate the structure. I know, I know, there are other considerations, but this seems annoying. I'm sure that the addition of the CTE fully expected that at some point semicolons would be required for all code.

Brent wrote about this a few years ago. The Syntax page for T-SQL currently says this about the semicolon: "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." There is no shortage of confusion about where terminators might be required and how to structure code, partially because SQL hasn't ever used terminators and the evolution of the language has been a bit inconsistent with regard to structure.

These days it seems that nothing will ever be removed. It appears that nothing else will be deprecated in this age of cloud software and feature toggles.I suspect at this point that we'll see features wither in the codebase, not receiving future development if Microsoft doesn't see them as valuable, living in limbo forever.

I don't think we'll ever see terminators required, and as the amount of legacy code grows, it becomes less and less likely they will become mandated.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating