sql注释的多行注释

大哥大姐,哪位知道,sql注释的多行注释
最新回答
林间小鹿

2026-10-30 07:55:10

一、多行注释

与C语言相同的程序注释符号,即“/**/”。“/*”用于注释文字的开头,“*/”用于注释文字的结尾,可在程序中标识多行文字为注释。

二、格式:/*注释内容*/。

例子:

DECLARE @myvariable DATETIME

1、The following statements retrieve the current date and time and extract the day of the week from the results.

2、SELECT @myvariable=GETDATE()。

SELECT DATENAME(dw,@myvariable)。



扩展资料:

一、单行注释

1、ANSI 标准的注释符“--” 用于单行注释,格式:--注释内容。

2、例子:

use pangu-- 使用名为pangu的数据库。

declare@startdate datetime。

set@startdate=‘1/1/2000’。

select‘Start Date:’+convert(varchar(12)@startdate)。

convert()函数用于转换

数据类型
。

注意这里的注释'--'符号后需要一个空格,注释才生效。

参考资料来源:

百度百科-sql注释

我萌怪我咯

2026-07-03 15:47:12

与C语言相同的程序注释符号,即“/**/”。“/*”用于注释文字的开头,“*/”用于注释文字的结尾,可在程序中标识多行文字为注释。
格式:/*注释内容*/
例子:
DECLARE @myvariable DATETIME
/*
The following statements retrieve the current date and time and extract the day of the week from the results.
*/
SELECT @myvariable=GETDATE()
SELECT DATENAME(dw,@myvariable)