Create, Rename, Delete file folder thru SQL

  • Hello All,

    Is there a way to Create, Rename and Delete file folder thru SQL Server?

    Thanks.

  • Take a look at xp_cmdshell command on BOL.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • You'd be better off doing this in Powershell or VBScript and calling the script from T-SQL if you need to.

  • Thank you melton for your suggestion, I will look into xp_cmdshell.

    Steve, How do I call vbScript from SQL? Thanks for your time.

  • xp_cmdshell or an Agent Job.

    T-SQL works within the server. It cannot see anything outside of the SQL service without a shell like xp_cmdshell.

    You would use the same commands that you would use from a Command Prompt window.

  • Please what is BOP?

  • BOL is SQL Server Books OnLine. If you Google "BOL SQL" and click "I'm feeling lucky" it will take you right there.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Thank you Mr Allen

  • Steve Jones - Editor (8/12/2009)


    You'd be better off doing this in Powershell or VBScript and calling the script from T-SQL if you need to.

    I know it's an old post but I have to ask...

    Why? :blink: What are the advantages to doing it that way over, say, just calling some good ol' fashioned DOS commands from xp_CmdShell?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply