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.
Author |
Topic |
pattonjo
Starting Member
11 Posts |
Posted - 2013-07-28 : 18:56:00
|
I have a table with two columns. Name and FilePath (varchar(255)).How can I query to check to see if that particular file exists, and only return "broken" paths. |
|
MuMu88
Aged Yak Warrior
549 Posts |
Posted - 2013-07-28 : 20:14:38
|
[CODE]SELECT * From @TEMP WHERE Name like '%File1%'[/CODE]What do you mean by "broken" paths? like this:[CODE]SELECT * From @TEMP WHERE Name like '%File1%' and FilePath like '%broken%';[/CODE] |
|
|
pattonjo
Starting Member
11 Posts |
Posted - 2013-07-28 : 23:02:00
|
two columnsName FilePathABC N:\files\abc.pdfDEF N:\files\def.pdf GHI N:\files\ghi.pdf How can I query this to validate that the document exists at the given path. In other words, I want to return a dataset of all of the FilePaths where the document DOESN'T exist. It would have to check the FilePath for each row to see if it exists or not, and return the ones that do not. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
pattonjo
Starting Member
11 Posts |
Posted - 2013-07-28 : 23:45:52
|
I can get it to return the correct bit when explicitly giving the filepath.SET NOCOUNT ONDECLARE @iFileExists INTEXEC master..xp_fileexist 'N:\files\abc.pdf', @iFileExists OUTPUTPRINT @iFileExistsHow can I use this to loop through a column and check each row, while displaying 'name', 'filepath', 'bit' |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-07-29 : 03:17:30
|
use while loop or cursor to loop through your records and check one by one KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-29 : 05:06:02
|
I would have done this using SSIS File System task.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|