Commenting a Query

Visual Database Tools

Visual Database Tools

Commenting a Query

You can document a query or view by adding a comment to it.  You can enter a comment with a property page or in the SQL pane.

You should avoid entering the two-character strings "/*" and "*/" within your comments. 

If you change the type of query (for example, from a SELECT query to an UPDATE query), the query's comment is deleted. 

If you add a comment to a view, the text that you add is returned by the sp_help stored procedure.

To add a comment to a query with the property page

  1. Right-click in the Query Designer or View Designer, then select Property Pages from the shortcut menu.

  2. If you are working on a query, select the Query tab.  If you are working on a View, select the View tab.

  3. Enter the comment in the SQL Comment field.

To add a comment to a query in the SQL pane

  1. Situate the text cursor at the beginning or end of the SQL pane.  Enter the comment, preceded by "/*" and followed by "*/".
    You must situate the cursor at the beginning or end of the SQL pane because you cannot enter embedded comments.

  2. Click in the Diagram pane or Grid pane.
    The comment is automatically removed from the SQL pane and appended to the existing comment text in the SQL Comment field on the Query or View property page.