I wanted to find out how to open a file in a Trigger?
I have a need to open a file, write some information
when trigger fires and then close it.
Thank you,
-Me"Me" <Me@.discussions.microsoft.com> wrote in message
news:09CD669D-4E60-44C6-AFD2-3F2385AEFDC2@.microsoft.com...
>I wanted to find out how to open a file in a Trigger?
> I have a need to open a file, write some information
> when trigger fires and then close it.
> Thank you,
> -Me
>
I'm not sure if this will work from within a Trigger, but you can take a
look at the xp_cmdshell stored procedure. Another option might be to create
a COM object (or .NET object in a COM wrapper) and use the sp_OA* stored
procedures to instantiate the object and call it's methods.
Rick Sawtell
MCT, MCSD, MCDBA|||I don't recommend executing this type from triggers. The transaction is open
and the rows are locked
while the trigger is executing, and the modification will fail if the code i
n the trigger fails. I
would insert relevant data in a table and then create a SQL Server Agent job
that read rows off of
that table and does the necessary "external" processing.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Me" <Me@.discussions.microsoft.com> wrote in message
news:09CD669D-4E60-44C6-AFD2-3F2385AEFDC2@.microsoft.com...
>I wanted to find out how to open a file in a Trigger?
> I have a need to open a file, write some information
> when trigger fires and then close it.
> Thank you,
> -Me
>|||Thank you Rick.
-Me
"Rick Sawtell" wrote:
> "Me" <Me@.discussions.microsoft.com> wrote in message
> news:09CD669D-4E60-44C6-AFD2-3F2385AEFDC2@.microsoft.com...
>
> I'm not sure if this will work from within a Trigger, but you can take a
> look at the xp_cmdshell stored procedure. Another option might be to crea
te
> a COM object (or .NET object in a COM wrapper) and use the sp_OA* stored
> procedures to instantiate the object and call it's methods.
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>|||Tibor,
Thank you, I agree with you, we should adopt another approach.
-Me
"Tibor Karaszi" wrote:
> I don't recommend executing this type from triggers. The transaction is op
en and the rows are locked
> while the trigger is executing, and the modification will fail if the code
in the trigger fails. I
> would insert relevant data in a table and then create a SQL Server Agent j
ob that read rows off of
> that table and does the necessary "external" processing.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Me" <Me@.discussions.microsoft.com> wrote in message
> news:09CD669D-4E60-44C6-AFD2-3F2385AEFDC2@.microsoft.com...
>
>
No comments:
Post a Comment