0

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
  • What are you going to do after you have the file list? Maybe SSIS would be more suitable tool for you? Commented Mar 9, 2017 at 12:01

1 Answer 1

2

You have 3 options (at least) for doing that.

  1. You can use xp_cmdshell for interacting with File System. CheckHere
  2. You can create a CLR assembly and use it in the procedure. CheckHere
  3. 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.

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any options to get the details using stored procedure/functions in sql server.
@Gopi, There is additional option using OLE Automation procedures of SQL Server. Updated the post with links. I hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.