Use annotations in SQL Server
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
May be interested
- What is VPS? VPS used to do? What is VPS different from Server?what is vps? vps used to do? what is vps different from server ?. when you intend to learn about network data or open the website, you will definitely be introduced to many different server and server services. but server hosting has a lot of tricks
- 7 great ideas using Raspberry Pi as a serverraspberry pi is a great solution for many computer projects, from learning programming to remote control a car to building a basic stop-motion animation studio. but do you know that raspberry pi can also be used as a server? here are some ideas for using raspberry pi as a server.
- Add captions to spreadsheets in Excel 2013when setting up a spreadsheet with hundreds, thousands of data boxes, these data boxes will be linked together but with a large number of such cells even you may forget some information about the box yourself. which data is in this record, what documents ... if you share this spreadsheet with others, the problem is even more complicated.
- New points in SQL Server 2017the sql server 2017 version is primarily connected to linux, bringing the power of sql to linux. in short, you can install sql server 2017 on linux, using sql server 2017 on linux-based docker containers. sql server 2017 also allows you to choose development languages, develop it on-premise or cloud-based.
- Instructions for setting up and managing FTP Server on Windows 10if you want to create a private cloud for sharing and converting large files without restrictions, you can create an ftp server (file transfer protocol server) on your windows 10 computer.
- Create VPN Server on Windows 8no need to install any additional applications, you can easily 'turn' your computer into a vpn server if you're using windows 8. in this way, you can share data from the computer. as a simple lan system in the form of remote access. & a
- What is the future of server virtualization?server virtualization can help combat poor server performance, make better use of computing capabilities, limit energy consumption and improve data center flexibility.
- Learn about the architecture of MS SQL Serverin the previous articles, you already know briefly about sql server, how to install sql server on the computer. in this section we will learn about the architecture of sql server.
- Instructions for installing MS SQL Serverthis is a step by step guide to installing ms sql server.
- How to install DNS Server on Windows Server 2019from microsoft, the domain name system (dns) is one of the industry standard protocol sets that includes tcp / ip, along with dns client and dns server that provide name resolution services that map names to the ip addresses of computers. .