Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AAAV
Posting Yak Master
152 Posts |
Posted - 2014-09-17 : 13:00:46
|
Is there any book for understanding xsd?This is a part of my xsd where parttype occurs inside both the ReplacementPart and Optional_ReplacementPart. XML sample===<ReplacementPart> <PartType id="1580" /> <PartType id="45973" /> </ReplacementPart><Optional_ReplacementPart> <PartType id="150" /> <PartType id="4593" /> </Optional_ReplacementPart>XSD(PartType element is used in both the tables)===<xs:element name = "PartType" > <xs:complexType> <xs:simpleContent> <xs:extension base = "xs:string" > <xs:attribute name = "id" use = "required" type = "xs:string" sql:mapped="false"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name = "ReplacementPart" sql:mapped="true" sql:relation="MotorOperationReplacementPart" sql:relationship="MotorOperation_to_MotorOperationReplacementPart"> <xs:complexType> <xs:sequence> <xs:element ref = "PartType" maxOccurs = "unbounded" sql:mapped="true" sql:field="PartType" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name = "Optional_ReplacementPart" sql:mapped="true" sql:relation="OptionalOperationReplacementPart" sql:relationship="OptionalOperation_to_OptionalOperationReplacementPart"> <xs:complexType> <xs:sequence> <xs:element ref = "PartType" maxOccurs = "unbounded" sql:mapped="true" sql:field="PartType"/> </xs:sequence> </xs:complexType> </xs:element>1) when I use the above XSD the xml bulk load loads both partype and id columns null(I understand id is null because it is unmapped)2) when I remove the mapping false in id and let it map to the id column in the tables... I get loadwithscript.vbs(19, 1) XML SAX Parser: Data mappingto column 'id' was already found in the data. Make sure that no two schema definitions map to the same column.How do I use the same xsd element to map to different columns in different tables. I can provide more code but thought of keeping it simple.. Thanks in advance. |
|
|
|
|