The title kind of says it, but I’ll elaborate a bit.
I use SQL Server 2005, and I'm writing an export query that’ll return a list of users. Some users have profile images, some don’t. The profile image is not represented in the database, at all. There’s just a file on the filesystem, named [username].jpg. So what I need to do is to check if such a file exists for the user.
Well if you must you could always do the following
DECLARE @fso int,
@hr int
EXECUTE @hr = sp_OACreate 'Scripting.FileSystemObject', @fso OUT
From that you may (if hr=0) get a good old FileSystemObject.
From that you should be able to do the following
EXECUTE sp_OAMethod @fso, 'FileExists', @hr OUT, @FileName
But really, for wanting to do this, you're going to hell ****grin****
Of course this depends on a lot of things, your SQL server configuration, the user it runs under, etc etc. Your mileage may vary.