Hi,
imagine i have a table called tbl_pictures: picture_id and picture_name and there are about 500 records in that table. The pictures are stored in c:\mypics\
The problem: not all photos exists anymore, but they ARE still in the table. How can i list only those pictures that DO exist?
I do know how to check if a single file exists with "EXEC Master.dbo.xp_fileexist @filename", but i don't know how to do it in a loop.
It should look something like below:
SELECT picture_name FROM tbl_pictures WHERE (xp_fileexist '@picture_name' = true)
Anyone? :)
edit:
i've used an asp.net loop instead which calls a file-exists function. When it returns false the record is deleted from the table. Problem solved.