Press "Enter" to skip to content

Removing Comments from Code with T-SQL

Tomaz Kastrun is not pleased with these comments:

This procedure will strip all the comments from your T-SQL query and return only the parts, that are uncommented.

Procedure is able to detect and remove the following type of comments (regardless of the position of the code or comment):

– in-line comment ( — comments )

– multiline comment (Slash star /* comments)

– in-line comment block

– comment within a comment (multiline block)

Read on to learn how.