Showing posts with label parent. Show all posts
Showing posts with label parent. Show all posts

Friday, March 30, 2012

load both parent and child into one table!

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

load both parent and child into one table!


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.examnotes.net ***
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.examnotes.net ***
> 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.examnotes.net ***
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.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||Hi Irwin, thank you very much.
Hongta
*** Sent via Developersdex http://www.examnotes.net ***
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...
>
>

Friday, February 24, 2012

List grouping

I am needed assistance with getting multiple datasets data in one LIST.
I have 1 parent table with 2 child tables.
The parent table contains the primary key for the 2 child tables.
This is a 1 to many relationship to both the child tables where 1 child
table could have 5 records and the other could have 15.
I need data from the parent as well.
I am having a hard time getting this data grouped on the ID when trying to
nest a list inside a list. It does not seem to work.
Any suggestions?
--
<moojjoo/>Hi
I am not sure I understand the requirement but if it is grouping you
are after , why not use a stored procedure to shape your dataset so
that the parent and child ids are returned together. That way you will
not need multiple lists.
Cheers
Shai
On Nov 30, 1:25 am, Moojjoo <Mooj...@.discussions.microsoft.com> wrote:
> I am needed assistance with getting multiple datasets data in one LIST.
> I have 1 parent table with 2 child tables.
> The parent table contains the primary key for the 2 child tables.
> This is a 1 to many relationship to both the child tables where 1 child
> table could have 5 records and the other could have 15.
> I need data from the parent as well.
> I am having a hard time getting this data grouped on the ID when trying to
> nest a list inside a list. It does not seem to work.
> Any suggestions?
> --
> <moojjoo/>|||Shaikat,
I got it to work using Subreports. Pretty cool solution and I believe that
is the right way to do it, but remember there is always more then one way to
skin a cat. Or program as we all know.
I basically had an ID = RaID (Parent) in table "Risk Assessment"
With two other child tables called - "Control Gap" and "Mitigation Control"
both with the foreign key of RaID.
Now there could have been 20 Control Gaps and 2 Mitigation Controls related
to that RaID foreign key plus i was pulling data from the parent table hence
using joins to return all the data, but as you kow repeating rows were be
returned.
So to solve the problem I basically passed the RaID from the SSRS LIST to 2
sub reports as parameters to only return the data based on the RaId and that
way the data would return properly. I read a number of articles and learned
this was the best way to do this since the control gap data and mitigating
data were both sub data of the Parent table.
I am what you would call a high novice to SQL Server and walking with
Reporting services.
I was wondering are there issues with having numerous datasets for reports.
I have yet to see a performance issue. I have based all my datasets from
stored proces and every thing is running great.
My training - reading books and hacking away for 10 years with Microsoft
Products. Thank you Microsoft for helping me earn a pay check. Maybe one
day I will make it as an MVP.
--
<moojjoo/>
"shaikat.das@.gmail.com" wrote:
> Hi
> I am not sure I understand the requirement but if it is grouping you
> are after , why not use a stored procedure to shape your dataset so
> that the parent and child ids are returned together. That way you will
> not need multiple lists.
> Cheers
> Shai
> On Nov 30, 1:25 am, Moojjoo <Mooj...@.discussions.microsoft.com> wrote:
> > I am needed assistance with getting multiple datasets data in one LIST.
> >
> > I have 1 parent table with 2 child tables.
> >
> > The parent table contains the primary key for the 2 child tables.
> >
> > This is a 1 to many relationship to both the child tables where 1 child
> > table could have 5 records and the other could have 15.
> >
> > I need data from the parent as well.
> >
> > I am having a hard time getting this data grouped on the ID when trying to
> > nest a list inside a list. It does not seem to work.
> >
> > Any suggestions?
> >
> > --
> > <moojjoo/>
>|||Glad to see you found a solution :-)
Cheers
Shai