tsql - How do I get a filelist from the local filesystem in SQL Server 2005? -
The title type says, but I'll expand a bit.
I use SQL Server 2005, and I'm writing an export query that will return a list of users. Some users have profile pictures, do not do anything, profile image does not exist in the database, of course. There is only one file on file system, named [username] .jpg. So what I need to do is to check whether such a file exists for the user.
OK if you can always do the following tasks
DECLARE @fso int, @hr int extt @ er = sp_OACreate 'scripting.file system object', @ fsiaa From that you get a good old (if HR = 0)
You should be able to do the following
EXCUTE sp_OAMethod @so, 'FileExists', @ ur, off, @philname But in fact, to do this, you are going to hell **** smile ****
Of course it depends on many things, your SQL server configuration, user Which runs it etc. Your mileage may vary.
Comments
Post a Comment