词条 | sql注释 |
释义 | 在Transact-SQL 中可使用两类注释符,单行注释和多行注释。 一、单行注释ANSI 标准的注释符“--” 用于单行注释,格式:--注释内容。 例子: use pangu declare@startdate datetime set@startdate=‘1/1/2000’ select‘Start Date:’+convert(varchar(12)@startdate) --convert()函数用于转换数据类型 二、多行注释与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) 三、使用快捷键sql server 2005 注释快捷键 选中语句 先按ctrl+k 再按ctrl+c sql server 2005 取消注释快捷键 选中语句 先按ctrl+k 再按ctrl+u |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。