How To Enter Comments in Transact-SQL Statements?

Submitted by: Administrator
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
Submitted by: Administrator

Read Online MS SQL Server Job Interview Questions And Answers