I wrote a CLR assembly that exports table data to an XML file. Now I want to import this data into a temporary table on another instance. The structure of the XML file is as follows:
<row>
<SystemInformationID>1</SystemInformationID>
<Database_x0020_Version>10.00.80404.00</Database_x0020_Version>
<VersionDate>2008-04-04T00:00:00</VersionDate>
<ModifiedDate>2008-04-04T00:00:00</ModifiedDate>
</row>
I want the XML to be processed at the destination and imported into the temporary table. I also have a main table, so I can get the table structure from there. Is there any way? I am using OPENXML, but it seems to be working incorrectly. I can read the XML file into a table that will be stored in a column with an XML data type. My problem is analyzing the data in this column. This is a temporary attempt:
CREATE TABLE
GO
INSERT INTO
SELECT * FROM OPENROWSET(
BULK 'c:\HISOutput.xml',
SINGLE_CLOB) AS x
DECLARE @x xml
DECLARE @id int
SELECT @x=XmlCol FROM
EXEC sp_xml_preparedocument @id OUTPUT, @x
SELECT *
FROM OPENXML (@id,'/row',2)
WITH
dbo.awbuildversion
this doesn't show the first column no matter how I change the OPENXML instruction.
tx in advance
source
share