SQL Transact Comments
Good comments show the purpose of your SQL transact query. They explain the actions that statement will perform.
SQL supports two methods to block or ‘Rem’ out transact statements.
1) Block Comments /* …. */
As the name suggests these comment are when you have a paragraph, or at least a sentence of text to introduce the script. The /* slash star.. star slash */ are mirror images or book marks.
/* start block. Tell your readers the intention of the script. When you have finished explaining, perhaps adding the date when created. You need to end the block and get on with the rest of the script so:
*/
USE Northwind
SELECT * from products
GO
2) Inline comments
USE Northwind
SELECT * from products
Where unitprice > 10
GO
2a) If you wanted to test your script without the following line
— Where unitprice > 10
Then you could add a pair of dashes to make an inline comment.
USE Northwind
SELECT * from products
— Where unitprice > 10
GO
2b) The other use of the — two dashes, is to make a comment after statement.
Then you could add a pair of dashes to make an inline comment.
USE Northwind
SELECT * from products — note products not orders
Where unitprice > 10
GO
Next step
Learn some more Verbs, create your own statements.