Home All Groups Group Topic Archive Search About

Stored Procedure and Command line

Author
16 Sep 2005 6:37 PM
timjo916
Simple question ...

From within an MS 2000 SQL database stored procedure, I need to execute a
DOS command that runs an application AND pass a parameter from the stroed
procedure to this command line application.  I also need to receive back a
parameter (result) from the DOS application into the stored procedure for
furhter processing.

An example with mock parameters set up would be greatly appreciated ...

Thanks in advance.

Author
16 Sep 2005 8:46 PM
John Bell
Hi

You can use xp_cmdshell to do this and there are examples in Books online
including one that create a string from a variable.

It is not a good idea to run any program that has a GUI.

Depending on how your program outputs the return value you can either
capture it to a file and then return use osql, Bulk insert, bcp, dts to load
this into a table.

Alternatively you may want to look at DTS to do it all such as
http://www.sqldts.com/default.aspx?251

John
Show quote
"timjo916" <timjo***@discussions.microsoft.com> wrote in message
news:5E664F62-A3CC-4DEC-B52E-8A20300FC459@microsoft.com...
> Simple question ...
>
> From within an MS 2000 SQL database stored procedure, I need to execute a
> DOS command that runs an application AND pass a parameter from the stroed
> procedure to this command line application.  I also need to receive back a
> parameter (result) from the DOS application into the stored procedure for
> furhter processing.
>
> An example with mock parameters set up would be greatly appreciated ...
>
> Thanks in advance.

AddThis Social Bookmark Button