存储过程的错误高手看看
create proc alls
as
begin
declare @in int
declare @sql varchar(500)
set @in=0
while @in <100
begin
set @sql= 'insert into jiameng(comname,comadd,comtel,jiamengcontent) values( ' ' '+cast(@in as varchar(50))+ ' ' ', 'ss ', 'qq ', 'zz ') '
exec(@sql)
set @in=@in+1
end
end
go
服务器: 消息 170,级别 15,状态 1,过程 alls,行 9
第 9 行: 'ss ' 附近有语法错误。
谢谢啊
------解决方案--------------------改成
set @sql= 'insert into jiameng(comname,comadd,comtel,jiamengcontent) values( ' ' '+cast(@in as varchar(50))+ ' ' ', ' 'ss ' ', ' 'qq ' ', ' 'zz ' ') '
------解决方案-------------------- create proc alls
as
begin
declare @in int
declare @sql varchar(500)
set @in=0
while @in <100
begin
set @sql= 'insert into jiameng(comname,comadd,comtel,jiamengcontent) values( ' ' '+cast(@in as varchar(50))+ ' ' ', ' 'ss ' ', ' 'qq ' ', ' 'zz ' ') '
exec(@sql)
set @in=@in+1
end
end
go