create proc sea
as
declare @num char
declare @pwd char
go
set @num=(select usernum from table1 where username='陆勋')
go
set @pwd=(select userpwd from table1 where username='陆勋')
print @num,@pwd检查语法的时候提示@num @pwd使用前必须声明

解决方案 »

  1.   


    create proc sea
    as
    declare @num char
    declare @pwd char
     
    select @num=usernum from table1 where username='陆勋'
     
    select @pwd=userpwd from table1 where username='陆勋'print @num,@pwd
      

  2.   

    select @num=usernum, @pwd=userpwd  from table1 where username='陆勋'
      

  3.   

    go表示一个批,一个批处理的不能访问别外一个批处理的,作用域的问题,去掉go