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've just finished reading the article "Use annotations in SQL Server" edited by the TipsMake team. You can save use-annotations-in-sql-server.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.
- Caption tags in HTML
- The difference between web server and app server
- Network basics: Part 3 - DNS Server
- How to set up your own Git server on Linux
- Use IIS to set up FTP Server on Windows
- How to change DNS server on the most popular routers
- Instructions for notes in PDF files
- Microsoft PowerPoint is about to add annotations and subtitles in real time
- What is VPS? VPS used to do? What is VPS different from Server?
- 7 great ideas using Raspberry Pi as a server
- Add captions to spreadsheets in Excel 2013
- New points in SQL Server 2017
- Instructions for setting up and managing FTP Server on Windows 10
- Create VPN Server on Windows 8