我想从 txt 文件中读取行并在过程 TESTSP 中进行一些处理。但我确实有一些错误。我应该如何重写我的查询?此致。
代码:
DECLARE @i int
set @i =0
WHILE(@i<85)
begin
@i=@i+1;
if(@i<10)
begin
exec TESTSP'C:\dosya\X_20130208_0'+@i+'.txt'
end
else
begin
exec TESTSP 'C:\dosya\X_20130208_'+convert(@i as varchar(2))+'.txt'
end
end
错误:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '@i'.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near '+'.
Msg 102, Level 15, State 1, Line 12
Incorrect syntax near '+'.