I want to get the file details like file date, size, etc... from a folder using SQL server. Please share me the suggestion of both using command shell and without using command shell.
1 Answer
You have 3 options (at least) for doing that.
- You can use
xp_cmdshellfor interacting with File System. CheckHere - You can create a CLR assembly and use it in the procedure. CheckHere
- Using OLE Automation. Also CheckHere
Please keep in mind that both of the approaches have their procs and cons. The 1st option is easy and you need sysadmin permissions to use it directly. The 2nd option give you more control and can be used with less permissions, but you need to put some effort code the CLR assembly.