有用sql语句一
时间:2021-07-01 10:21:17
帮助过:2人阅读
DECLARE
2 @retval int,
3 @param1 int
4 EXECUTE @retval=master.dbo.xp_fileexist
‘D:\TkSoft\SamplePic\FabricImg\A1NC8606.BMP‘,
@param1 OUTPUT
5 IF @param1 = 0
6 PRINT ‘File does not exist!‘
7 ELSE
8 PRINT ‘File exists!‘
9
10
11 select * into samp
12 from openrowset(
‘SQLOLEDB‘,
‘192.168.0.180‘;
‘sa‘;
‘hualong2012‘, soyerp.dbo.samp)
13
14
15
16 declare @auid nvarchar(
50)
17 declare auth_cur
cursor for
18 select replace(花型编号,
‘ ‘,
‘" "‘)
19 from samp
20 open auth_cur
21 fetch next from auth_cur
into @auid
22 while (
@@fetch_status=0)
23 begin
24 DECLARE
25 @retval int,
26 @param1 int,
27 @name nvarchar(
200)
28 set @name=‘D:\TkSoft\SamplePic\FabricImg\‘+@auid+‘.BMP‘
29 EXECUTE @retval=master.dbo.xp_fileexist
@name,
@param1 OUTPUT
30 IF @param1 = 0
31 print @auid
32 fetch next from auth_cur
into @auid
33 end
34 close auth_cur
35 deallocate auth_cur
有用sql语句一
标签: