Hi,
how to get the list of files name from the directory using sp_OAmethod or sp_OAgetproperty(scripting.filesystemobject) in sql server 2008. I tried with below query but I'm unable to get the fileid from this method. Anyone help me to fix this issue.
@ObjFileSystem int,
@ObjFolID
int,
@ObjFilID
int,
@ObjItemID
int
EXEC
dbo.sp_OACreate'Scripting.FileSystemObject', @ObjFileSystem OUT
EXEC
dbo.sp_OAMethod@ObjFileSystem,'GetFolder', @ObjFolID OUT,'C:\temp'
EXEC
dbo.sp_OAMethod@ObjFolID,'Files', @ObjFilIDOUT
EXEC
dbo.sp_OAMethod@ObjFilID,'Items', @ObjItemIDOUT
select
@ObjItemID