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 [email protected] and [email protected]
if @@rowcount>0
begin
select top 1 @uuid=pe_UserId
from dbo.[useruser1]
where [email protected] and [email protected]
update useruser1 set pe_cishu=pe_cishu+1,[email protected] where [email protected]
exec('Select pe_jibie,pe_zeou,pe_Photo,pe_nianji,pe_zhuye,pe_zhaopian From ' + @biaoshu + ' Where [email protected]')
end
else
return 1
end
创建没一点问题,但是执行的时候,给上参数,就会提示
(1 行受影响)
(1 行受影响)
消息 137,级别 15,状态 2,第 1 行
必须声明标量变量 "@uuid"。
(1 行受影响)
为什么啊,大侠帮我
------解决方案--------------------
- SQL code
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 [email protected] and [email protected] if @@rowcount>0 begin select top 1 @uuid=pe_UserId from dbo.[useruser1] where [email protected] and [email protected] update useruser1 set pe_cishu=pe_cishu+1,[email protected] where [email protected] declare @strSql nvarchar(2048) set @strSql = 'Select pe_jibie,pe_zeou,pe_Photo,pe_nianji,pe_zhuye,pe_zhaopian From ' + @biaoshu + ' Where [email protected]' execute sp_executesql @strSql,[email protected] int',@uuid end else return 1end
------解决方案--------------------