Hello,
I'm trying to import a Xml file in a table.
It's working find, but when the data are inserted, my trigger on this
table doesn't work ?
I put my code below.
Best regards
Thank's
David
Xml file :
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes "?>
<RTAVIS>
<FILENAME>03-05-073.PDF</FILENAME>
<idvir>1030</idvir>
<code>9219142 </code>
<mnt>4337,88 </mnt>
</RTAVIS>
Xsd file :
<?xml version="1.0" ?>
<Schema xmlns="urn:sche mas-microsoft-com:xml-data"
xmlns:dt="urn:s chemas-microsoft-com:xml:datatyp es"
xmlns:sql="urn: schemas-microsoft-com:xml-sql" >
<ElementType name="FILENAME" dt:type="string " />
<ElementType name="idvir" dt:type="string " />
<ElementType name="code" dt:type="string " />
<ElementType name="mnt" dt:type="string " />
<ElementType name="RTAVIS" sql:relation="a c_export_and_pa th">
<element type="FILENAME" sql:field="path " />
<element type="idvir" sql:field="nume ro_virement" />
<element type="code" sql:field="code _affilie" />
<element type="mnt" sql:field="mont ant_remise" />
</ElementType>
</Schema>
Vbs file:
Set objBL = CreateObject("S QLXMLBulkLoad.S QLXMLBulkLoad")
objBL.Connectio nString = "provider=SQLOL EDB.1;data
source=*****;da tabase=*****;ui d=*****;pwd=*** **"
objBL.ErrorLogF ile = "C:\Temp\error. xml"
objBL.SchemaGen = True
objBL.CheckCons traints = True
objBL.KeepIdent ity = False
objBL.BulkLoad = true
objBL.Execute "C:\Temp\921914 2_MAPPING.xsd", "C:\Temp\921914 2.xml"
Set objBL = Nothing
Trigger source code :
CREATE TRIGGER [dbo].[trg_ac_export_a nd_path] ON
dbo.ac_export_a nd_path
FOR INSERT
AS
DECLARE @id AS varchar(50)
SELECT @id = 'A'+convert(var char, [id]) FROM inserted
INSERT INTO ac_path([id], [path]) SELECT @id, path FROM inserted
END