麻烦大神帮忙解释以下代码的意思,谢谢
declare @P1 int
set @P1=180150181
declare @P2 int
set @P2=8
declare @P3 int
set @P3=1
declare @P4 int
set @P4=0
exec sp_cursoropen @P1 output, N'select * from tb1'
, @P2 output, @P3 output, @P4 output
select @P1, @P2, @P3, @P4

解决方案 »

  1.   

    declare @P1 int--定义变量,变量名P1,类型为int
    set @P1=180150181--给变量赋值
    declare @P2 int--定义变量,变量名P2,类型为int
    set @P2=8--给变量赋值
    declare @P3 int--定义变量,变量名P3,类型为int
    set @P3=1--给变量赋值
    declare @P4 int--定义变量,变量名P4,类型为int
    set @P4=0--给变量赋值
    exec sp_cursoropen @P1 output, N'select * from tb1'
    , @P2 output, @P3 output, @P4 output
    --调用存储过程,存储过程名为sp_cursoropen,后面是它的5个参数,output指定该参数为输出参数
    select @P1, @P2, @P3, @P4--查询这4个变量的值
      

  2.   


    declare @P1 int--定义变量,变量名P1,类型为int
    set @P1=180150181--给变量赋值
    declare @P2 int--定义变量,变量名P2,类型为int
    set @P2=8--给变量赋值
    declare @P3 int--定义变量,变量名P3,类型为int
    set @P3=1--给变量赋值
    declare @P4 int--定义变量,变量名P4,类型为int
    set @P4=0--给变量赋值
    exec sp_cursoropen @P1 output, N'select * from tb1'
    , @P2 output, @P3 output, @P4 output
    --调用存储过程,存储过程名为sp_cursoropen,后面是它的5个参数,output指定该参数为输出参数
    select @P1, @P2, @P3, @P4--查询这4个变量的值