Friday, 29 May 2009

To semi-colon or not to semi-colon

Do you need to end your T-SQL statements with a semi-colon (;)?
No, at least not yet. As stated in the following web page (http://msdn.microsoft.com/en-us/library/ms143729.aspx) "Not ending Transact-SQL statements with a semi-colon." will be replaced by "End Transact-SQL statements with a semi-colon ( ; )." in
future versions...

Is it a good practice to end your statements with a semi-colon?
Yes, because:
- it will be mandatory in the future.
- you need to use it with CTE.(where the preceeding statement needs to end with a ";")
- you need to end MERGE statements with a ";"

No comments:

Post a Comment