create proc insert_sjdd @sjdd nvarchar(4000), @kcapid nvarchar(43) as begin declare @temp nvarchar(18) declare @sj nvarchar(3) declare @dd nvarchar(15) while(charindex(',',@sjdd)<>1) begin set @temp=substring(@sjdd,1,charindex(',',@sjdd))-1 set @sj=substring(@temp,1,charindex('[',@temp)-1) set @dd=substring(@temp,charindex('[',@temp)+1,charindex(']',@temp)-1) insert into sjdd(kcapid,sj,dd) values (@kcapid,@sj,@dd) set @sjdd = stuff(@sjdd,1,charindex(',',@sjdd),'') end end好了,你括号没配对,BEGIN开始的第一句,改好了的这是
@sjdd nvarchar(4000),
@kcapid nvarchar(43)
as
begin
declare @temp nvarchar(18)
declare @sj nvarchar(3)
declare @dd nvarchar(15)
while(charindex(',',@sjdd)<>1)
begin
set @temp=substring(@sjdd,1,charindex(',',@sjdd))-1
set @sj=substring(@temp,1,charindex('[',@temp)-1)
set @dd=substring(@temp,charindex('[',@temp)+1,charindex(']',@temp)-1)
insert into sjdd(kcapid,sj,dd) values (@kcapid,@sj,@dd)
set @sjdd = stuff(@sjdd,1,charindex(',',@sjdd),'') end
end好了,你括号没配对,BEGIN开始的第一句,改好了的这是