Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    105

    Unanswered: Executing batch script from MSSQL

    If I have an application running on MSSQL is it possible that if an action occurs on the application side that a stored procedure can execute a batch script?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    xp_cmdshell. requires certains permissions. it is likely whatever programming language you are using, also has a command for command line and it would probably be better to do it from the application instead of the database.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    May 2004
    Posts
    105
    OK, so probably since the application uses asp I could call a script from this side, right?

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Quote Originally Posted by lauramccord
    OK, so probably since the application uses asp I could call a script from this side, right?
    ASP has it's own little peculiar security issue. The package has to be executed from the security context of the IUSR_XXXX NT account that executes the pages on the web server. If this is'nt done right you can create a security problem.

    Do a search on this forum using ASP and DTS as terms.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Jan 2005
    Location
    TempDb
    Posts
    228
    I suggest avoiding xp_CmdShell - outta process can mean inna trouble.

    What you want to do is a bit quirky, and there may be a better solution if you were to provide more details (for example, why are you seeking a synchronous solution? and what exactly is that batch script doing?).

    Outta band is outta sight!
    I love deadlines. I like the whooshing sound they make as they fly by. Douglas Adams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •