Making a trigger in SQL

Asked By 0 points N/A Posted on -
qa-featured

Hi! I am basically new to SQL and I need some assistance. I need to make a trigger that will allow me to generate an xml file of the date whenever an action takes place. I have been searching for options and I have encountered a clause that can generate an output as xml format. But it does not allow me to make an actual xml file that I can put in a path. Can you give me other options that I could use? I’m looking forward to your response. Thank you.

SHARE
Answered By 0 points N/A #105725

Making a trigger in SQL

qa-featured

Hello Destin,

It is possible for you to make a trigger that will allow me to generate an xml file of the date whenever an action takes place, but I will share for a method which uses a third party application, which you therefore need to have in case you will be interested to use it.

You can query the data from the already created XML by the use of OPENXML in the FROM clause, but there is one thing that you cannot do and that is writing to it. You can also generate string which has been formatted using XML by use of the FOR XML clause but just like the FROM clause, you will not be able to write to this file.

The only way that seems possible for you to write the FOR XML query as file on a disk will be by using the following command:

EXEC dbo.xp<_>cmd<_>shell 'bcp '

So you may want to try it.

__

Regards
Clair Charles

Login/Register to Answer

Related Questions