Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Check File

Author  Topic 

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-05-25 : 13:00:17
How can we check multiple file using Master.dbo.xp_fileexist

I am trying to check two files by this script but it is throwing error
am i doing something wrong?




DECLARE @FILE VARCHAR(50)
DECLARE @FILE2 VARCHAR(50)
--DECLARE @DEST_FILE VARCHAR(100)
DECLARE @TSQL VARCHAR(100)
DECLARE @File_Exists int

--SET @DEST_FILE = 'D:\data'
SET @FILE='d:\ifts.txt'
set @file2= 'd:\manoj.txt'
exec Master.dbo.xp_fileexist @file,@file2,@File_Exists OUT
IF @File_Exists = 1
PRINT 'Files Found'
ELSE PRINT 'Files Not Found'
GO

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-25 : 13:10:36
Syntax: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT]
One file per call.
So you have to call it for each file.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -