Use annotations in SQL Server
This article will show you how to use annotations in SQL Server statements.
This article will show you how to use annotations in SQL Server statements.
Describe
SQL Server allows you to put comments next to statements for commenting, memorization and further explanation. These comments may appear on a line or spread across multiple lines in the work screen.
Syntax using annotation
There are two syntaxes that can be used to create comments in SQL statements:
Use notation -
Usage is as follows:
-- chú thích tại đây
In SQL Server, comments that begin with a symbol - must be at the end of the statement and force a line break after the end of the comment.
Use the symbol / * and * /
Usage is as follows:
/* chú thích tại đây */
In SQL Server, the annotation begins with the symbol / * and ends with * / can be used anywhere in the SQL statement. This comment may extend over several lines.
For example, comment one line
A line comment may appear in many different ways. It can be in the middle of a command or end of a statement, even lying on a single line. Specifically, we can follow the following examples:
Comments appear in the middle of the command:
SELECT / * Author: quantrimang.com * / employee_id, last_name
FROM employees;
Annotation appears at the end of the command:
SELECT employee_id, last_name / * Author: quantrimang.com * /
FROM employees;
Or:
SELECT employee_id, last_name - Author: quantrimang.com
FROM employees;
Annotation is located on a single line:
SELECT employee_id, last_name
/ * Author: quantrimang.com * /
FROM employees;
For example, the caption extends across multiple lines
In SQL Server, you can write comments and comments on multiple lines while using SQL statements. An example is as follows:
SELECT employee_id, last_name
/ *
* Author: quantrimang.com
* Purpose: Displays annotations spread across multiple lines in an SQL statement
* /
FROM employees;
The caption of the recently executed example is on the four lines of the working screen.
Or you can use this syntax:
SELECT employee_id, last_name / * Author: quantrimang.com
Purpose: Displays annotations spread across multiple lines in an SQL statement. * /
FROM employees;
Marking and commenting next to a statement by annotation makes it easy to understand and control, as well as to fix errors for your work more quickly and conveniently.
Good luck!
Previous article: Find User in SQL Server
Next lesson: LITERAL (Hang) in SQL Server
You should read it
- SQL Server 2019 - Microsoft Relational Database Management System
- Learn about the architecture of MS SQL Server
- Instructions for installing MS SQL Server
- New points in SQL Server 2017
- HAVING clause in SQL Server
- Instructions for installing SQL Server 2019
- Reporting service in MS SQL Server
- What is MS SQL Server?
- PIVOT clause in SQL Server
- Conditions NOT in SQL Server
- Condition LIKE in SQL Server
- The difference between web server and app server
Maybe you are interested
5 quietest keyboards Harvest Moon guide for beginners Invite to download the space theme wallpapers on the NASA XS inspired by NASA History of Earth formation and 25 milestones (Part I) Can humans and animals survive without oxygen? How long does it take you to reach the other half through the center of the Earth vertically?