Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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