MS SQL Server Concepts and Programming Question:
Download Questions PDF

How To Enter Comments in Transact-SQL Statements?

Answer:

There are 2 ways to enter comments within Transact-SQL statements:

* Starting comments with two dashes "--": Everything between "--" and the end of the line is treated as a comment.
* Entering comments between "/*" and "*/": Everything between "/*" and "*/" is treated as a comment.

Here are some good examples of how to enter comments:

/* The following statement
creates a table
called ggl_links */
CREATE TABLE ggl_links (
id INTEGER PRIMARY KEY, -- the primary key
url VARCHAR(80) NOT NULL, -- address of the link
notes VARCHAR(1024),
counts INT, -- number of clicks
created DATETIME NOT NULL DEFAULT(getdate())
);
GO

-- Get rid of this table
DROP TABLE ggl_links;
GO

Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
How To Start and End Transact-SQL Statements?What Is a Transact-SQL Statement Batch in MS SQL Server?