Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2003
    Posts
    14

    Unhappy Unanswered: problems when run xp_cmdshell

    when I run the next procedure :


    CREATE PROCEDURE usp_hh_runpackage AS

    EXECUTE master..xp_cmdshell 'dtsrun /SMCMSEG001DBS /Ugefaweb /P2s3rg3f4w3b /NDTS_HHReport'
    GO

    I get the following error:

    'dtsrun' is not recognized as an internal or external command,
    operable program or batch file.

    Can you help me?

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Do you have the sql server binn directory in the path of the login used on the sql server machine ? Do you have dtsrun.exe on the sql server machine ?

  3. #3
    Join Date
    Jan 2003
    Posts
    14
    Originally posted by rnealejr
    Do you have the sql server binn directory in the path of the login used on the sql server machine ? Do you have dtsrun.exe on the sql server machine ?
    yes i give the instruccion on the control panel enviroments variables for execution in anywhere i am but it doesn´t work.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Run xp_cmdshell with the 'set' command and see what it returns. The problem is that either xp_cmdshell cannot find the file or that the file does not exist.

  5. #5
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320
    Originally posted by mcarrillo
    yes i give the instruccion on the control panel enviroments variables for execution in anywhere i am but it doesn´t work.
    Open a new console windows to see if you can run dtsrun from command line.
    If not you need to modify your PATH variable to add the mssql path

    Code:
    set mssql_binhome=x:\msssql\binn
    
    set PATH = %mssql_binhome%;%PATH%
    Olivier Miossec
    --
    http://www.lasso-developpeur.net/
    --

  6. #6
    Join Date
    Jan 2003
    Posts
    14
    Originally posted by omiossec
    Open a new console windows to see if you can run dtsrun from command line.
    If not you need to modify your PATH variable to add the mssql path

    Code:
    set mssql_binhome=x:\msssql\binn
    
    set PATH = %mssql_binhome%;%PATH%


    I can run the dtsrun in ms-dos but when I run the application I receive that message. I modify the path but i get the same error. do you have another options?

    thanks.

  7. #7
    Join Date
    Jan 2003
    Posts
    14
    Originally posted by omiossec
    Open a new console windows to see if you can run dtsrun from command line.
    If not you need to modify your PATH variable to add the mssql path

    Code:
    set mssql_binhome=x:\msssql\binn
    
    set PATH = %mssql_binhome%;%PATH%


    I can run the dtsrun in ms-dos but when I run the application I receive that message. I modify the path but i get the same error. do you have another options?

    thanks.

  8. #8
    Join Date
    Feb 2002
    Posts
    2,232
    Can you run your the xp_cmdshell in query analyzer - or does it fail ?

  9. #9
    Join Date
    Jan 2003
    Posts
    14
    Originally posted by rnealejr
    Can you run your the xp_cmdshell in query analyzer - or does it fail ?

    When I run in the query analyzer the xp_cmdshell to run the dtsrun command is when fail. and give me this error:

    'dtsrun' is not recognized as an internal or external command,
    operable program or batch file.

  10. #10
    Join Date
    Feb 2002
    Posts
    2,232
    What is returned when you run xp_cmdshell 'set path' ?

  11. #11
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    2

    Lightbulb Re: problems when run xp_cmdshell

    The xp_cmdshell probably does not recognize the path to your dtsrun on the server machine. You probably need to have that path set on the server machine. Or try putting full path such as xp_cmdshell 'x:\mssql\binn\dtsrun.....'


    :::radzi::

    Originally posted by mcarrillo
    when I run the next procedure :


    CREATE PROCEDURE usp_hh_runpackage AS

    EXECUTE master..xp_cmdshell 'dtsrun /SMCMSEG001DBS /Ugefaweb /P2s3rg3f4w3b /NDTS_HHReport'
    GO

    I get the following error:

    'dtsrun' is not recognized as an internal or external command,
    operable program or batch file.

    Can you help me?

  12. #12
    Join Date
    Jan 2003
    Posts
    14

    Smile

    Thanks to all, I found that if I put the command in the directory of
    \winnt\system32 it works !!!

    Thanks and regards.

    Mirtha

  13. #13
    Join Date
    Feb 2002
    Posts
    2,232
    That is fine to help you discover the problem but don't keep the dtsrun.exe file in that directory (that is a system directory) - you need to solve the initial problem. Keep dtsrun.exe where is belongs - moving the file creates many problems - just maintenance alone is a problem. Again, this is a path problem so verify your path.

  14. #14
    Join Date
    Jan 2003
    Posts
    14

    Red face

    Originally posted by rnealejr
    That is fine to help you discover the problem but don't keep the dtsrun.exe file in that directory (that is a system directory) - you need to solve the initial problem. Keep dtsrun.exe where is belongs - moving the file creates many problems - just maintenance alone is a problem. Again, this is a path problem so verify your path.
    Well I am in another question because I see if I run in ms-dos that it works but the query analizer don´t find the correct path.
    could you be more specific where I have to make the correct path ?

    Thanks .and you are right .
    Last edited by mcarrillo; 01-08-03 at 18:59.

Posting Permissions

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