Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Is it possible?

Author  Topic 

daos
Starting Member

4 Posts

Posted - 2005-07-22 : 17:16:45
Hi!

Is it possible to run an exe from a stored procedure?

Thanks!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-07-22 : 18:56:47
yes.
look into xp_cmdshell

Go with the flow & have fun! Else fight the flow
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-07-22 : 19:07:14
Take a look at xp_cmdshell in the Books Online. There are some serious cavets to using it, so read it and understand them.

Personally, I try to avoid this at all costs becuase I've been bitten by an EXE that hung nad basically hung my SQL server in the process.


quote:
xp_cmdshell operates synchronously. Control is not returned until the command shell command completes.


Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-07-23 : 10:30:44
some other "serious caveats" that Michael alluded to are the security issues when users (of your stored procedure) are allowed to execute xp_cmshell. They would then also be allowed to run any os command on the database server (via query analyzer and xp_cmdshell).



Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -