In TSQL, comments can be added to code in two ways:
1.Single-line comments: These start with two hyphens (–) and continue until the end of the line. For example:
-- This is a single-line comment
2.Multi-line comments: These start with a forward slash and an asterisk (/) and continue until the closing asterisk and forward slash (/). For example:
/* This is a multi-line comment. It can span multiple lines and is often used to provide detailed explanations or to comment out large blocks of code. */
When writing comments, it’s important to keep them clear and concise, and to use them to explain why something is being done rather than how it is being done. This helps to make your code more readable and easier to understand for other developers who may be reading it.