Home All Groups Group Topic Archive Search About

Calling External Program from SQL Server 2000

Author
6 Apr 2006 4:04 PM
Greg Busby
I want to create a file folder on a server when a new record is Inserted
into a SQL Server 2000 table.  I was thinking that I would create a simple
windows console application in C# to handle the folder creation.  I want to
run that external program from an Insert Trigger on the table.  How do I do
that or is there a way to create the folder from within SQL server?  Thanks
in advance for any help or guidance given.

Author
6 Apr 2006 4:15 PM
Tibor Karaszi
You could call xp_cmdshell or use SP_OACreate to instantiate a COM object from your trigger. But
don't do that. The insert will be blocked until the trigger has finished, and errors will roll back
the insert. I.e., this is a good way to get bad performance. Have the trigger insert relevant data
into a table and then let an Agent job run every minute (or so) and read off of this table and do
whatever needs to be done. If you were on SQL Server 2005, you would use Service Broker for this,
btw...

Show quote
"Greg Busby" <gbu***@med-edge.com> wrote in message news:OWKkkPZWGHA.4972@TK2MSFTNGP02.phx.gbl...
>I want to create a file folder on a server when a new record is Inserted into a SQL Server 2000
>table.  I was thinking that I would create a simple windows console application in C# to handle the
>folder creation.  I want to run that external program from an Insert Trigger on the table.  How do
>I do that or is there a way to create the folder from within SQL server?  Thanks in advance for any
>help or guidance given.
>

AddThis Social Bookmark Button