Hi, how can load both parent and child into one table use the
SQLXMLBulkload.3.0 object like following? Thanks a lot.
Hongtao
<xml>
<ti>date</ti>
<origin>name</origin>
<title>
<titledetail>content</titledetail>
</title>
</xml>
into table
CREATE TABLE Title (
ti VARCHAR (100) NOT NULL ,
origin VARCHAR (100) NOT NULL ,
titledetail VARCHAR (100) NOT NULL )
)
GO
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
You would create an XSD where the "xml" element maps to a table and "ti",
"origin", and "Titledetail" map to columns. Then set sql:is-constant="true"
on the "title" element. I think that should do it.
Irwin
"henry job" <anonymous@.comcast.com> wrote in message
news:uL7O71LBFHA.3840@.tk2msftngp13.phx.gbl...
>
> Hi, how can load both parent and child into one table use the
> SQLXMLBulkload.3.0 object like following? Thanks a lot.
> Hongtao
> <xml>
> <ti>date</ti>
> <origin>name</origin>
> <title>
> <titledetail>content</titledetail>
> </title>
> </xml>
> into table
> CREATE TABLE Title (
> ti VARCHAR (100) NOT NULL ,
> origin VARCHAR (100) NOT NULL ,
> titledetail VARCHAR (100) NOT NULL )
> )
> GO
>
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
|||Hi Irwin, thank you very much. I am new with XML. Data xml like
following. Could you post an XSD? thank you very much!!
Hongtao
<xml>
<ti>date</ti>
<origin>name</origin>
<title>
<titleid>id</titleid>
<titledetail>content</titledetail>
</title>
</xml>
into table
CREATE TABLE Title (
ti VARCHAR (100) NOT NULL ,
origin VARCHAR (100) NOT NULL ,
titledetail VARCHAR (100) NOT NULL )
)
GO
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||I believe it would be something like:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="xml" sql:relation="foo" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ti" sql:field="bar1" />
<xsd: element name="origin" sql:field="bar2"/>
<xsd:element name="title" sql:is-constant="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="titleid" sql:field="bar3"/>
<xsd:element name="titledetail" sql:field="bar4"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
You would have to change "foo" to the table name and "bar" 1-4 to column
names, and may need to / want to add data type info.
"henry job" <anonymous@.comcast.com> wrote in message
news:ucJe2XOBFHA.3524@.TK2MSFTNGP15.phx.gbl...
> Hi Irwin, thank you very much. I am new with XML. Data xml like
> following. Could you post an XSD? thank you very much!!
> Hongtao
> <xml>
> <ti>date</ti>
> <origin>name</origin>
> <title>
> <titleid>id</titleid>
> <titledetail>content</titledetail>
> </title>
> </xml>
> into table
> CREATE TABLE Title (
> ti VARCHAR (100) NOT NULL ,
> origin VARCHAR (100) NOT NULL ,
> titledetail VARCHAR (100) NOT NULL )
> )
> GO
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
|||Hi Irwin, thank you very much.
Hongta
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||I've looked *everywhere* for something like this, and this is the best
example ever!
KB Article 316005 should include this information.
Chris Leiter
MCSE CCNA MCT MCDST MCSA
"Irwin Dolobowsky [MS]" wrote:
> I believe it would be something like:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xsd:element name="xml" sql:relation="foo" >
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="ti" sql:field="bar1" />
> <xsd: element name="origin" sql:field="bar2"/>
> <xsd:element name="title" sql:is-constant="true">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="titleid" sql:field="bar3"/>
> <xsd:element name="titledetail" sql:field="bar4"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> You would have to change "foo" to the table name and "bar" 1-4 to column
> names, and may need to / want to add data type info.
>
> "henry job" <anonymous@.comcast.com> wrote in message
> news:ucJe2XOBFHA.3524@.TK2MSFTNGP15.phx.gbl...
>
>
sql
No comments:
Post a Comment