xp_cmdshell

  • hi all,

    SQL Server 2000 SP3

    Windows 2000 Server

    i want to execute an application through sql.

    i used

    exec xp_cmdshell 'c:\abc.exe'

    to start my program.

    but the program is not started and it hangs for ever. i tried it in SQL Query analyser.

    i tried this by connecting Sql query analyser using

    'sa' account and 'administrator' (windows login)

    as well

    am i missing something here

    Regards

    Ramesh

  • Does this program have any GUI components, like msgboxes or similar?

    xp_cmdshell is for commandline programs only - no GUI (or other interactive parts) will work.

    /Kenneth

  • Yup, while

    exec master..xp_cmdshell 'time' seems to hang

    exec master..xp_cmdshell 'time/t' will work fine.

    The only way I've found to start such a programm is to use DTS (yuk!) with a win32 process task.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • thanks for the immediate replies.

    actually the exe is a program written in VB 6.0

    im quite new to this .can you can post script on how to execute this program by passing parameters?

    thanks and regards

    Ramesh

     

  • is it possible to start a program (with parameters)

    from a stored procedure or a trigger.

    and the program should run out of process .

    i mean not using the same memory of sql server??

    rgds

    ramesh

  • All programs started through xp_cmdshell are run out of process from SQL Server.

    You can think of it as a Transact SQL DOS-box if you will.

    The good thing is that if the program behaves bad, it won't necessarily take the server down for you.

    The downside is that checking the results of the called program gets more involved.

    For your VB-app, if it can run in silent mode - ie not demand any interactive input at all - then it will probably be possible to kick it off with xp_cmdshell.

    If it demands user input, or must display some window, xp_cmdshell is not the way to go.

    /Kenneth

Viewing 6 posts - 1 through 5 (of 5 total)

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