请大家帮忙看看什么出错的
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 @t=@t+1
Insert into ZK_Quality_Operate (QCode) Values ('ZL'+right(100000+rtrim(@t),4),
set @n=@n+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 @t=@t+1
Insert into ZK_Quality_Operate (QCode) Values ('ZL'+right('100000'+rtrim(@t),4),这里多了个逗号
set @n=@n+1
end
这里还少一个end
下次写begin end 的时候记得先配对,不然嵌套太多了会忘记,没事就结贴