HomeSQL ServerSQL Server Error Msg 113 – Missing end comment mark ‘*/’.

SQL Server Error Msg 113 – Missing end comment mark ‘*/’.

In this blog post, let’s learn about the error message “113 – Missing end comment mark ‘*/’.” in Microsoft SQL Server, the reason why it appears and the solution to fix it.

SQL Server Error Message

113 – Missing end comment mark ‘*/’.

Reason for the Error

The SQL Server error message 113 – Missing end comment mark ‘/’, occurs when a comment that was started with the opening comment mark “/” is not properly terminated with the closing comment mark “*/”. This can happen in various SQL Server scripts or code where comments are used.

Here are some possible reasons for this error:

  1. Typing error: It is possible that the opening comment mark “/*” was typed accidentally, and the intended comment was never completed.
  2. Syntax error: If a comment is used in a query or stored procedure, it is important to ensure that it is properly terminated to avoid any syntax errors.
  3. Comments within a comment: If there are nested comments within the SQL code, then the comment marks can get confused leading to an error.

Example of missing end comment mark in a SQL query:

SELECT *
FROM my_table
/* This is a comment that was not properly closed 
WHERE condition = 'some_value'

In this example, the comment started with “/” but was not properly terminated with “/”. This would result in the SQL Server error message 113.

Example of missing end comment mark in a script

/*
This script creates a new table in the database.
*/

CREATE TABLE my_new_table (
    id INT PRIMARY KEY,
    name VARCHAR(50) NOT NULL
/* Missing end comment mark
);

In this example, the comment in the script was not properly terminated, and the CREATE TABLE statement contains a syntax error because of the missing end comment mark. This would result in the SQL Server error message 113.

Solution

To fix this error, you can try the following solutions:

  1. Double-check the code and verify that any comment that is started with “/” is properly terminated with “/”.
  2. Review the code or script to ensure that there are no nested comments that are not properly terminated.
  3. In some cases, the error may be caused by a missing semicolon (;) or another syntax error in the SQL code, so check for any other errors and fix them accordingly.
  4. Use a code editor or an integrated development environment (IDE) that supports syntax highlighting to help identify any missing comment marks.

Once you have identified and fixed the error, you can rerun the code or script, and the error message should no longer appear.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

When dealing with a relational database management system (RDBMS) like SQL Server, compatibility level is an important concept to understand....
In this blog post, let’s learn about the error message “49975 – Unable to load controller client certificate due to...
In this blog post, let’s learn about the error message “49973 – Cannot remove tempdb remote file to local tempdb...