经典sql

DECLARE
 @retval int,
 @param1 int
 EXECUTE @retval=master.dbo.xp_fileexist 'D:\TkSoft\SamplePic\FabricImg\A1NC8606.BMP', @param1 OUTPUT 
 IF @param1 = 0
 PRINT 'File does not exist!'
 ELSE
 PRINT 'File exists!' 
 
 
 select * into samp
from  openrowset('SQLOLEDB', '192.168.0.180'; 'sa'; 'hualong2012', soyerp.dbo.samp) 



declare @auid nvarchar(50)
declare auth_cur cursor for
select replace(花型编号,' ','" "')  
from samp
open auth_cur
fetch next from auth_cur into @auid
while (@@fetch_status=0)
  begin
   DECLARE
 @retval int,
 @param1 int,
 @name nvarchar(200)
 set @name='D:\TkSoft\SamplePic\FabricImg\'+@auid+'.BMP'
 EXECUTE @retval=master.dbo.xp_fileexist @name, @param1 OUTPUT 
 IF @param1 = 0
 print @auid
    fetch next from auth_cur into @auid
  end
close auth_cur
deallocate auth_cur

 

posted @ 2016-08-20 16:42  ChineseMoonGod  阅读(162)  评论(0编辑  收藏  举报