|
Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - Entering Comments in Transact-SQL Statements
By: FYIcenter.com
(Continued from previous topic...)
How To Enter Comments in Transact-SQL Statements?
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 fyi_links */
CREATE TABLE fyi_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 fyi_links;
GO
(Continued on next topic...)
- What Is SQL Language?
- What Is Transact-SQL Language?
- What Is a Transact-SQL Statement?
- How To Start and End Transact-SQL Statements?
- How To Enter Comments in Transact-SQL Statements?
- What Is a Transact-SQL Statement Batch?
- What Happens to a Statement Batch If There Is a Compilation Error?
- How To Use GO Command in "sqlcmd"?
- How To Create User Messages with PRINT Statements?
- How Many Categories of Data Types Used by SQL Server?
- What Are Exact Numeric Data Types?
- What Are Approximate Numeric Data Types?
- What Are Date and Time Data Types?
- What Are Character String Data Types?
- What Are Unicode Character String Data Types?
- What Are Binary String Data Types?
- What Are the Differences between CHAR and NCHAR?
- What Are the Differences between CHAR and VARCHAR?
- What Are the Differences between DECIMAL and FLOAT?
|