I am using SQL XML bulk load to inject the data direct to the database. My XML and xsd are as the following:
XML:
<?xml version="1.0"?>
<Data>
<USEFUL>
<Value>3.1</Value>
<Date>12/20/2001</Date>
</USEFUL>
<Something>
<Value>3.1</Value>
<Date>12/20/2001</Date>
</Something>
</Data>
XSD:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:simpleType name="anyElement">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z]+" />
</xs:restriction>
</xsd:simpleType>
<xsd:element name="USEFUL" sql:relation="DATA" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Value" type="xsd:string" />
<xsd:element name="Date" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element type="anyElement" sql:relation="NON-DATA" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Value" type="xsd:string" />
<xsd:element name="Date" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I want to insert the "USEFUL" elements into the same table, and everything else into a different table. Is there a way to use the wildchar * for the name or a regular expression to filter the unwanted stuff into another table?
Thank you.