怎樣寫sqlxml需求的結構文件?
<ROOT>
<TR>
<CustomerId> 1111 </CustomerId>
<CompanyName> Sean Chai </CompanyName>
<City> NY </City>
</TR>
<TR>
<CustomerId> 1112 </CustomerId>
<CompanyName> Tom Johnston </CompanyName>
<City> LA </City>
</TR>
<TR>
<CustomerId> 1113 </CustomerId>
<CompanyName> Institute of Art </CompanyName>
</TR>
</ROOT>
========================》
<?xml version= "1.0 " ?>
<Schema xmlns= "urn:schemas-microsoft-com:xml-data "
xmlns:dt= "urn:schemas-microsoft-com:xml:datatypes "
xmlns:sql= "urn:schemas-microsoft-com:xml-sql " >
<ElementType name= "CustomerId " dt:type= "int " />
<ElementType name= "CompanyName " dt:type= "string " />
<ElementType name= "City " dt:type= "string " />
<ElementType name= "TR " sql:relation= "cust ">
<element type= "CustomerId " sql:field= "CustomerID " />
<element type= "CompanyName " sql:field= "CompanyName " />
<element type= "City " sql:field= "City " />
</ElementType>
</Schema>
[解决办法]
一定要sqlxml吗?
如果只是倒XML数据进入SQL SERVER,可以考虑用OpenXML