SQL 注释符号示例
这些示例说明了使用 SQL 注释指示符的不同方式。
以下示例使用了每一种注释符号,包括双连字符(--)、花括号({ })、C 语言样式(/* . . .
*/)的注释符号在 SQL 语句后注释。该注释与语句显示在同一行。
SELECT * FROM customer; -- Selects all columns and rows
SELECT * FROM customer; {Selects all columns and rows}
SELECT * FROM customer; /*Selects all columns and rows*/
以下三个示例与前面的示例使用了相同的 SQL 语句和相同的注释,但注释自成一行:
SELECT * FROM customer;
-- Selects all columns and rows
SELECT * FROM customer;
{Selects all columns and rows}
SELECT * FROM customer;
/*Selects all columns and rows*/
以下示例中,用户输入与前面的示例中相同的 SQL 语句,但现在输入一条多行注释(或者对于双
连字符有两条注释):
SELECT * FROM customer;
-- Selects all columns and rows
-- from the customer table
SELECT * FROM customer;
{Selects all columns and rows
from the customer table}
SELECT * FROM customer;
/*Selects all columns and rows
from the customer table*/
一条 SQL 语句中出现任意三种样式的注释:
SELECT * -- Selects all columns and rows
FROM customer; -- from the customer table
SELECT * {Selects all columns and rows}
FROM customer; {from the customer table}
SELECT * /*Selects all columns and rows*/
FROM customer; /*from the customer table*/
如果您使用花括号或 C 语言样式的注释被成对的开始和结束符号定界,那么结束注释符号必须与
开始注释符号的样式相同。
SQL 注释中的非 ASCII 字符
如果数据库语言环境支持非 ASCII 字符(包括多字节字符),则可以在 SQL 注释中输入非
ASCII 字符。关于 SQL 注释 GLS 方面的进一步信息,请参阅 GBase 8s GLS 用户指南。
GBase Migration Toolkit 迁移工具手册-1.2(3)
最新推荐文章于 2022-08-02 14:46:54 发布