declare @i int  
select @i=0   
while @i<=160  
begin   
  exec sp_textcopy '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\1.wav','where 编号=1','I'
  set @i=@i+1   
end

解决方案 »

  1.   

    -- 调用存储过程的语句如果是一批sql语句中的一句, 则exec不能省
    declare   @i   int  select   @i=0   
      while   @i<=160  
      begin   
        exec sp_textcopy   '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\1.wav','where   编号=1','I'
              set   @i=@i+1   
      end   
      

  2.   

    declare   @i   int  select   @i=0   
      while   @i<=160  
      begin   
        exec sp_textcopy   '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\@i.wav','where   编号=@i','I'
              set   @i=@i+1   
      end 请问若改成  exec sp_textcopy   '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\@i.wav','where   编号=@i','I'
    又会出错,应怎么办?我就是想把'D:\毕业设计\sound\0a\0aw目录下的1.wav--160.wav存入数据库应怎么办?小弟在这里先谢了
      

  3.   

    TEXTCOPY Version 1.0
    DB-Library version 8.00.194
    SQL Server 'SSQ' Message 137: 必须声明变量 '@i'。 (Concerning line 1)
    DB-Library Error 10007: SQL Server 常规错误: 请检查来自 SQL Server 的消息。
    ERROR: Query execution failed.
    NULL
    就是这个错,我单独导入行。如  sp_textcopy   '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\5.wav','where   编号=5','I'
    但该为@i就不行了,应该怎么写?1.wav--160.wav怎么导入,写成
     exec sp_textcopy   '192.168.0.2','sa','','史双全','aaa','英语单词','D:\毕业设计\sound\0a\0aw\@i.wav','where   编号=@i','I'
    对吗?
      

  4.   

    --这样行吗?
    declare @i int  
    select @i=0   
    while @i<=160  
    begin
      declare @sql varchar(8000)
      set @sql='exec sp_textcopy ''192.168.0.2'',''sa'','''',''史双全'',''aaa'',''英语单词'',''D:\毕业设计\sound\0a\0aw\1.wav'',''where 编号='+cast(@i as varchar)+''',''I''' 
      exec(@sql)
      set @i=@i+1   
    end
      

  5.   

    现在可以执行了,但是所有的都是存的1.wav,我是想把2.wav  3.wav   4.wav   160.wav
    分别存进对应的编号里。执行完会输出160个一样的提示
    TEXTCOPY Version 1.0
    DB-Library version 8.00.194
    Data copied into SQL Server image column from file 'D:\毕业设计\sound\0a\0aw\1.wav'.
    NULL
    ,是不是把1.wav存了160次阿,怎么依次存入阿,麻烦您了
      

  6.   

    --不好意思,看漏了一个@i
    declare @i int  
    select @i=0   
    while @i<=160  
    begin
      declare @sql varchar(8000)
      set @sql='exec sp_textcopy ''192.168.0.2'',''sa'','''',''史双全'',''aaa'',''英语单词'',''D:\毕业设计\sound\0a\0aw\'+cast(@i as varchar)+'.wav'',''where 编号='+cast(@i as varchar)+''',''I''' 
      exec(@sql)
      set @i=@i+1   
    end
      

  7.   

    这样只能拷前九个,到 第十个---第九十九个就会变成
    TEXTCOPY Version 1.0
    DB-Library version 8.00.194
    ERROR: Problem with file 'D:\毕业设计\sound\0a\0aw\72.wa'.
    NULL到100个以后就会变成TEXTCOPY Version 1.0
    DB-Library version 8.00.194
    ERROR: Problem with file 'D:\毕业设计\sound\0a\0aw\153.w'.
    NULL
    也就是扩展名会由.wav  变成.wa再变为.w  这是怎么回事????超级辛苦了
      

  8.   

    zjcxc(邹建) ( ) 信誉:673
    三级钻石没见过。。