sql存储过程问题,帮我啊
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[getUserNamebb]
@UserName varchar(100),
@paww varchar(100),
@biaoshu varchar(100)
as
begin
declare @cishu int,@mon int,@uuid int,@StartTime datetime
set @uuid=0;
set @StartTime =(select getdate())
select top 1 pe_pwdd,pe_sex,pe_nini,diqu1,diqu2,pe_UserId,addtime,pe_zhuye,pe_cishu
from dbo.[useruser1]
where pe_email=@UserName and pe_pwdd=@paww
if @@rowcount>0
begin
select top 1 @uuid=pe_UserId
from dbo.[useruser1]
where pe_email=@UserName and pe_pwdd=@paww
update useruser1 set pe_cishu=pe_cishu+1,zuihoutime=@StartTime where pe_userid=@uuid
exec('Select pe_jibie,pe_zeou,pe_Photo,pe_nianji,pe_zhuye,pe_zhaopian From ' + @biaoshu + ' Where pe_UserId=@uuid')
end
else
return 1
end
创建没一点问题,但是执行的时候,给上参数,就会提示
(1 行受影响)
(1 行受影响)
消息 137,级别 15,状态 2,第 1 行
必须声明标量变量 "@uuid"。
(1 行受影响)
为什么啊,大侠帮我
[解决办法]
ALTER PROCEDURE [dbo].[getUserNamebb] @UserName varchar(100), @paww varchar(100), @biaoshu varchar(100)asbegin declare @cishu int,@mon int,@uuid int,@StartTime datetime set @uuid=0; set @StartTime =(select getdate()) select top 1 pe_pwdd,pe_sex,pe_nini,diqu1,diqu2,pe_UserId,addtime,pe_zhuye,pe_cishu from dbo.[useruser1] where pe_email=@UserName and pe_pwdd=@paww if @@rowcount>0 begin select top 1 @uuid=pe_UserId from dbo.[useruser1] where pe_email=@UserName and pe_pwdd=@paww update useruser1 set pe_cishu=pe_cishu+1,zuihoutime=@StartTime where pe_userid=@uuid declare @strSql nvarchar(2048) set @strSql = 'Select pe_jibie,pe_zeou,pe_Photo,pe_nianji,pe_zhuye,pe_zhaopian From ' + @biaoshu + ' Where pe_UserId=@uuid' execute sp_executesql @strSql,N'@uuid int',@uuid end else return 1end
[解决办法]