In an attempt to try to help us, some clarification may be needed. Perhaps by reformulating the problem, you can tell us if this is what you are asking:
How to import existing xml into a SQL 2005 database without relying on the built-in xml type?
A fairly straightforward solution that you already mentioned is sp_xml_preparedocument, combined with openxml.
Hopefully the following example illustrates the correct use. For a more complete example, check the MSDN docs for Using OPENXML .
declare @XmlDocumentHandle int declare @XmlDocument nvarchar(1000) set @XmlDocument = N'<ROOT> <Customer> <FirstName>Will</FirstName> <LastName>Smith</LastName> </Customer> </ROOT>' -- Create temp table to insert data into create table
If you have an xml file and you use C #, then defining a stored procedure that does something similar above, and then transferring the contents of the entire xml file to the stored procedure as a string, should give you a pretty simple way to import xml into existing tables .
source share