当前位置: 代码迷 >> Sql Server >> 存储过程不能插入第二个参数,该如何解决
  详细解决方案

存储过程不能插入第二个参数,该如何解决

热度:46   发布时间:2016-04-24 09:00:29.0
存储过程不能插入第二个参数
ALTER PROCEDURE [dbo].[getaccount]
@shuliang int
@fuwuqi char(20)

as
declare @account char(100)
declare @mytable table(zhanghao char(100))
declare @jici int
set @jici = 1

while @jici <= @shuliang
begin
begin tran
select top 1 @account = account from account with (readpast,updlock) where state = '未使用'
update account set state = '已使用' where @account = account 
if @@ERROR = 0 
commit tran
else
rollback tran
insert into @mytable values(@account)
set @jici = @jici + 1
end
select * from @mytable


这里的第二个参数 @fuwuqi 报错,请问如何解决呀
------解决思路----------------------
参数之间加逗号啊。
------解决思路----------------------

@shuliang int,--这里加个逗号
 @fuwuqi char(20)
  相关解决方案