Earlier versions of SQL-Server didn't recommend the use of semicolons to terminate sql-statements.

Beginning with sql-server-2008 examples show, that now Microsoft recommends terminating with semicolons.

There are some formating tools which format sql queries and add the semicolons. I think the basic function is somewhere in SMO.

The only problem is that these tools remove all the comments.

Any ideas how to preserve all comments and how to add all recommend semicolons?

1 Answer 1


Start typing and don't trust code generators.

As you bring up procedures and code to edit it for other reasons, just add the semi-colon in then. You wouldn't want to deploy all your stored procedures in one batch just to add in the semi-colons only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.