注释掉某一条语句:用两个横杠

SQL里的查询分析器注释符号:–

建立一个临时表(存储过程里用):

CREATE TABLE #tmpBill_cyj
(

billNo varchar(20)

)

给临时表添加值:

set @billno=’11’   –设置billno的值为11,前面已定义 declare @billno varchar(20)
insert into #tmpbill_cyj(billno) values(@billno)

select * from #tmpbill_cyj    —查找该表的值

以下是完整的SQL:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

— =============================================
— Author:   <Author,,Name>
— Create date: <Create Date,,>
— Description: <Description,,>
— =============================================
ALTER PROCEDURE [dbo].[pr_cyj_test]
— Add the parameters for the stored procedure here
@billno varchar(20)
AS
BEGIN

CREATE TABLE #tmpBill_cyj
(

billNo varchar(20)

)
— SET NOCOUNT ON added to prevent extra result sets from
— interfering with SELECT statements.
set @billno=’11’
insert into #tmpbill_cyj(billno) values(@billno)

–select billno = @billno from bill_tab where billno=@billno
–print ‘清除财务结算成功!’

select * from #tmpbill_cyj

–if exists()

if @@rowcount>0
print ‘有值’
else
print ‘空值’
— Insert statements for procedure here
END

— pr_cyj_test ‘1230’