Skip to content

SQL Server Error Messages - Msg 113

Error Message

Server: Msg 113, Level 15, State 1, Line 1
Missing end comment mark '*/'.

Causes

There are 2 ways of specifying comments in a Transact-SQL script, namely with the use of two hyphens (--) for single-line comments, and with the use of / and / for multi-line comments. This error message occurs when using the / and / for multi-line comments and the closing */ is missing.

The simplest way to get this error is as follows:

/* This script is used to generate error 113
SELECT GETDATE()
Msg 113, Level 15, State 1, Line 3
Missing end comment mark '*/'.

Another way this error can be encountered is with nested comments. Transact-SQL supports nested comments, which are simply comments within another comment. If the / character pattern occurs anywhere within an existing comment, it is treated as the start of a nested comment and therefore, requires a closing / comment mark. To illustrate this situation, the following script will generate the error:

/*
PRINT 'Multi-line comments start with /*'
*/
SELECT GETDATE()
Msg 113, Level 15, State 1, Line 4
Missing end comment mark '*/'.

Even though there is a closing / comment mark in the script and even though the second opening / comment mark is inside a string value, the second opening / comment mark is treated as the start of a nested comment and there requires a separate closing / comment mark.

Even if the line containing opening /* comment mark is already commented out using the two hyphens single-line comment, the error will still be generated as can be seen in the following script:

/*
--PRINT 'Multi-line comments start with /*' 
*/
SELECT GETDATE()
Msg 113, Level 15, State 1, Line 4
Missing end comment mark '*/'.

Solution / Work Around

To avoid this error, make sure that there are the same number of closing / comment marks as there are opening / comment marks even if the opening /* comment marks are inside a string value or commented out using the two hyphen (--) single-line comment.

The first example earlier can easily be fixed by adding the closing */ comment mark at the end of the line of the comment.

/* This script is used to generate error 113 */
SELECT GETDATE()

The second and third example can easily be fixed also by adding an extra closing / comment mark at the end of the line of comments even though the starting / comment mark is inside a string value or inside a single-line comment:

/*
PRINT 'Multi-line comments start with /*'
*/ */
SELECT GETDATE()
/*
--PRINT 'Multi-line comments start with /*' 
*/ */
SELECT GETDATE()