Thursday, March 22, 2012

Calling External Program from SQL Server 2000

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.You could call xp_cmdshell or use SP_OACreate to instantiate a COM object fr
om your trigger. But
don't do that. The insert will be blocked until the trigger has finished, an
d errors will roll back
the insert. I.e., this is a good way to get bad performance. Have the trigge
r 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 Ser
vice Broker for this,
btw...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Greg Busby" <gbusby@.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 in
to a SQL Server 2000
>table. I was thinking that I would create a simple windows console applica
tion in C# to handle the
>folder creation. I want to run that external program from an Insert Trigge
r on the table. How do
>I do that or is there a way to create the folder from within SQL server? T
hanks in advance for any
>help or guidance given.
>

No comments:

Post a Comment