当前位置: 代码迷 >> Sql Server >> 请大伙帮忙看看什么出错的
  详细解决方案

请大伙帮忙看看什么出错的

热度:9   发布时间:2016-04-27 10:57:13.0
请大家帮忙看看什么出错的
ALTER PROCEDURE [dbo].[ZK_QOperater_AddInfoByPlan]
@total int 
as
Begin 
declare @t int
declare @n int
select @t= count(*) from ZK_Quality_Operate
set @n=0
while @n<@total

begin

set @[email protected]+1
Insert into ZK_Quality_Operate (QCode) Values ('ZL'+right(100000+rtrim(@t),4),
set @[email protected]+1
end

------解决方案--------------------
ALTER PROCEDURE [dbo].[ZK_QOperater_AddInfoByPlan]
@total int
as
Begin
declare @t int
declare @n int
select @t= count(*) from ZK_Quality_Operate
set @n=0
while @n<@total
  
begin
  
set @[email protected]+1
Insert into ZK_Quality_Operate (QCode) Values ('ZL'+right('100000'+rtrim(@t),4),这里多了个逗号
set @[email protected]+1
end
这里还少一个end

下次写begin end 的时候记得先配对,不然嵌套太多了会忘记,没事就结贴
  相关解决方案