Showing posts with label schema. Show all posts
Showing posts with label schema. Show all posts

Saturday, February 25, 2012

Annotated schema with views?

My database I am working with is very normalized so I ended up creating
views for certain tables which I then use in my XSD schema to select XML
from the DB.
The problem is the generated query does unecessary existence checks because
it doesn't read the underlying table column schema info.. the underlying
column is definately marked "NOT NULL".
...
(((((_Q6.A32 IS NOT NULL AND (_Q6.A32 =
N'11111145-110b-11c4-d8b3-c8c5154c131e') OR _Q6.A32 IS NOT NULL AND (_Q6.A32
= N'11111145-110b-11c4-d8b3-c8c5154c131d')) OR _Q6.A32 IS NOT NULL
...
How do I get rid of this unecessary checks. Surely it slows down performance
of the query.
Hi Joe
This should not be a problem. Since we do not look at the relational schema
when we generate the queries, we do not know whether the column can be null
or not. However, the query optimizier will know about it and this optimize
these expressions away. Thus, there should be no slow down in performance
due to these IS NOT NULL checks...
Best regards
Michael
"Joe" <morbidcamel@.msn.com> wrote in message
news:%23A08G49dFHA.2776@.TK2MSFTNGP10.phx.gbl...
> My database I am working with is very normalized so I ended up creating
> views for certain tables which I then use in my XSD schema to select XML
> from the DB.
> The problem is the generated query does unecessary existence checks
> because
> it doesn't read the underlying table column schema info.. the underlying
> column is definately marked "NOT NULL".
> ...
> (((((_Q6.A32 IS NOT NULL AND (_Q6.A32 =
> N'11111145-110b-11c4-d8b3-c8c5154c131e') OR _Q6.A32 IS NOT NULL AND
> (_Q6.A32
> = N'11111145-110b-11c4-d8b3-c8c5154c131d')) OR _Q6.A32 IS NOT NULL
> ...
> How do I get rid of this unecessary checks. Surely it slows down
> performance
> of the query.
>
>
|||OK, thank you for the advice. I got this information of existence checks
from the following article
http://support.microsoft.com/default...b;en-us;813955
I have another couple of questions though.
Question 1:
Will SQL 2005 support SQLXML natively and will the generated queries use FOR
XML PATH instead of the bulky FOR XML EXPLICIT. I know of the XML columns,
but I don't want to redo my tables necessarily.
Question 2:
I'm running into limitations in terms of performace with my XSD Schema
because there is simply a lot of elements.
I changed my XML format to be attribute centric and also added a lot of
clustered indexes on the keys and selected elements. This speeded up
tremendously. The problem is I have to add more elements in future and the
containment hierarchy is becoming huge. I ended up writting some logic to
query elements in fragments and add children manually. Will this be better
in SQL 2005 (if question 1 is "yes" ofcourse)?
Question 3:
UpdateGrams doesn't work well with identity columns. I ended using GUIDs
instead. This is fine in my current project, but I have another existing
project I want to convert to use SQLXML with .NET serialization which
depends hugely on identity values... will this be improved in future. I
suppose you can always write XSLT to generate clever SQL script or something
as a work-around, but I like the convenience of updategrams. Let MS do the
query generation work .
Question 4:
I know AS in 2005 uses XML/A. What is the chances in future of mapping XSD
to cubes instead of using XSLT to get the same effect? I don't know if this
is the right group to pose this question though.
Question 5:
SQL queries FOR XML doesn't support XML Attribute Groups, will this be
supported in future? Or is a XSLT the only way to do this as well?
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:Ok6LcyDeFHA.640@.tk2msftngp13.phx.gbl...
> Hi Joe
> This should not be a problem. Since we do not look at the relational
> schema when we generate the queries, we do not know whether the column can
> be null or not. However, the query optimizier will know about it and this
> optimize these expressions away. Thus, there should be no slow down in
> performance due to these IS NOT NULL checks...
> Best regards
> Michael
> "Joe" <morbidcamel@.msn.com> wrote in message
> news:%23A08G49dFHA.2776@.TK2MSFTNGP10.phx.gbl...
>
|||See below for the answers that I know (I am not the owner of the SQLXML
component for a couple of years now).
Best regards
Michael
"Joe" <morbidcamel@.msn.com> wrote in message
news:uc9DJzMeFHA.3620@.TK2MSFTNGP09.phx.gbl...
> OK, thank you for the advice. I got this information of existence checks
> from the following article
> http://support.microsoft.com/default...b;en-us;813955
> I have another couple of questions though.
> Question 1:
> Will SQL 2005 support SQLXML natively and will the generated queries use
> FOR XML PATH instead of the bulky FOR XML EXPLICIT. I know of the XML
> columns, but I don't want to redo my tables necessarily.
>
SQL 2005 will ship with SQLXML 4.0 which is SQLXML 3.0 SP2 with support for
the new datatypes and minus the IIS ISAPI for exposing templates and queries
through IIS (use ASP.Net instead is the recommendation).
I don't know whether they will start using FOR XML PATH, but given the cost
of rewriting, I would assume not.

> Question 2:
> I'm running into limitations in terms of performace with my XSD Schema
> because there is simply a lot of elements.
> I changed my XML format to be attribute centric and also added a lot of
> clustered indexes on the keys and selected elements. This speeded up
> tremendously. The problem is I have to add more elements in future and the
> containment hierarchy is becoming huge. I ended up writting some logic to
> query elements in fragments and add children manually. Will this be better
> in SQL 2005 (if question 1 is "yes" ofcourse)?
I am not sure that I have enough information about your scenario to provide
you good feedback. But I would assume that the SQLXML team is interested in
understanding your scenario and pain points.

> Question 3:
> UpdateGrams doesn't work well with identity columns. I ended using GUIDs
> instead. This is fine in my current project, but I have another existing
> project I want to convert to use SQLXML with .NET serialization which
> depends hugely on identity values... will this be improved in future. I
> suppose you can always write XSLT to generate clever SQL script or
> something as a work-around, but I like the convenience of updategrams. Let
> MS do the query generation work .
I will pass this along.

> Question 4:
> I know AS in 2005 uses XML/A. What is the chances in future of mapping XSD
> to cubes instead of using XSLT to get the same effect? I don't know if
> this is the right group to pose this question though.
You better suggest that in the AS newsgroup (although I will forward this
request/question).

> Question 5:
> SQL queries FOR XML doesn't support XML Attribute Groups, will this be
> supported in future? Or is a XSLT the only way to do this as well?
I don't quite understand this question. Attribute Groups are an XML schema
concept.
Could you please provide an example?
Thanks
Michael

> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:Ok6LcyDeFHA.640@.tk2msftngp13.phx.gbl...
>
|||Question 1:
There are no plans for using FOR XML PATH for SQL 2005. SQLXML will use FOR
XML EXPLICIT as it did in earlier releases..
Question 2:
In Sql 2005, there are no changes in the way SQLXML generate queries.
For the complexity brought by the elements, if you use simple type elements
in an xsd:sequence block, we will treat them as complex type elements and
generate a select statement for it. This is necessary to preserve the order
of the elements. If you specify the simple type elements in xsd:all group,
it will be treated like an attribute. On the other hand, there are some
other cases, a simple type element might be interpreted as complex type
elements so I would recommend using attributes vs elements.
If your schema is deep and consists of several complex type elements, the
generate FOR XML query will be also big. I couldn't understand how you can
partially generate hierarchies and combine them. Don't you need to find the
relevant parent Xml element to insert the Xml fragments? We would love to
hear more about your solution.
Question 3:
Updategrams have support for identity-columns. You may either use
updg:at-identity :
http://msdn.microsoft.com/library/de...egram_375f.asp
or use the sql:identity annoations in schema to specify the identity
columns.
http://msdn.microsoft.com/library/de...tions_7j03.asp
Let us know if these solutions don't work for you.
Question 4:
Question 5:
Ditto Michael here.
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:%23KzUBbTeFHA.2984@.TK2MSFTNGP15.phx.gbl...
> See below for the answers that I know (I am not the owner of the SQLXML
> component for a couple of years now).
> Best regards
> Michael
> "Joe" <morbidcamel@.msn.com> wrote in message
> news:uc9DJzMeFHA.3620@.TK2MSFTNGP09.phx.gbl...
> SQL 2005 will ship with SQLXML 4.0 which is SQLXML 3.0 SP2 with support
> for the new datatypes and minus the IIS ISAPI for exposing templates and
> queries through IIS (use ASP.Net instead is the recommendation).
> I don't know whether they will start using FOR XML PATH, but given the
> cost of rewriting, I would assume not.
>
> I am not sure that I have enough information about your scenario to
> provide you good feedback. But I would assume that the SQLXML team is
> interested in understanding your scenario and pain points.
>
> I will pass this along.
>
> You better suggest that in the AS newsgroup (although I will forward this
> request/question).
>
> I don't quite understand this question. Attribute Groups are an XML schema
> concept.
> Could you please provide an example?
> Thanks
> Michael
>
>
|||I have attached some XML sample. I cannot give you the schema because there
is some traid secrets in there It is based on the OMG MOF model and is
represented with interfaces and classes. Note that XSLT is used to transform
XML to XMI etc.
When requestig the fragments, they always have a PID (Parent Id) an so doing
I can add it to the parent element's contents. As you can see, the XML can
nest quite deeply. All XML are serialized into classes. The XML can also be
serialized to a DataSet for generating Diffgrams and/or SqlAdaptors... The
problem is, I have to add more model elements to my schema, and when
requesting a <Pkg> (package) element there can be up to 12 different
complex types retrieved.
In my case a typical X-Path query looks like
/Nms[@.ID='f5fde8f9-b359-5eca-71b6-8012ce027c32'] and for multiple elements
/Nms[@.ID='000000ea-00e0-00fa-b0ca-d0bad000eae0' or
@.ID='00000000-00fa-00b0-eae0-cad0bad00001' or
@.ID='e4ecf9eb-a252-4f0b-8a47-5bf305e36d27' or
@.ID='f5fde8f9-b359-5eca-71b6-8012ce027c33']. When the fragment is selected,
an additional query is done to get a collection of light-weight
"descriptors" of parent elements, which in turn is used to construct the
parent elements if they weren't already constructed. SQLXML and .NET
Serializer reduces the ETL time significantly. All I want though is super
fast query times, which up until now was quite impressive. The second
version of my framework is only due in another 6 months so there is still
some time to find a solution and all my hopes is currently on SQL2005.
As far as the attribute groups are involved I am refering to something like
:
<xs:attributeGroup name="XMI.element.att">
<xs:annotation>
<xs:documentation>
XMI.element.att defines the attributes that each XML element
that corresponds to a metamodel class must have to conform to
the XMI specification.
</xs:documentation>
</xs:annotation>
<xs:attribute name="xmi.id" type="xs:ID"/>
<xs:attribute name="xmi.label" type="xs:string"/>
<xs:attribute name="xmi.uuid" type="xs:string"/>
</xs:attributeGroup>
Can SQLXML annotations added to this attribute group be interpreted by the
SQLXML engine.
Here is sample XML requested from SQL.
....
<Nms N="Synap-c" ID="00000000-00fa-00b0-eae0-cad0bad00001"
PID="000000ea-00e0-00fa-b0ca-d0bad000eae0">
<An>SiloFx Synap-c suite of products</An>
<Tag>[Tank].[Synap-c]</Tag>
<NmsC>
<Nms N="Administrator" ID="e4ecf9eb-a252-4f0b-8a47-5bf305e36d27"
PID="00000000-00fa-00b0-eae0-cad0bad00001">
<An>{1}:{2}</An>
<Tag>[Tank].[Synap-c].[Administrator]</Tag>
<NmsC>
<Nms N="EAE" ID="f5fde8f9-b359-5eca-71b6-8012ce027c33"
PID="e4ecf9eb-a252-4f0b-8a47-5bf305e36d27">
<An>SiloFx Synap-c Enterprise Architect Edition (EAE) at
Administrator</An>
<Tag>[Tank].[Synap-c].[Administrator].[EAE]</Tag>
<NmsC>
<Pkg N="Types" ID="f5fde8f9-b359-5eca-71b6-8012ce027f30"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c33" V="Internal" A="false" R="true"
L="false" B="false">
<An>Administrator: Synap-c EAE types used in projects
and ontologies</An>
<PkgC />
</Pkg>
<Nms N="Projects"
ID="f5fde8f9-b359-5eca-71b6-8012ce027c31"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c33">
<An>Administrator: Synap-c EAE types used in projects
and ontologies</An>
<Tag>[Tank].[Synap-c].[Administrator].[EAE].[Projects]</Tag>
<NmsC>
<Pkg N="Application Architecture"
ID="54968e3e-8330-46e2-b2df-4c15e6e30c2f"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="Application Architecture"
ID="fce438aa-25e4-4f88-bd26-0a92ac82627c"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="As Is"
ID="9cfe0641-8e53-4586-bd72-d397fd890b28"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="SCM Organisational Structure"
ID="57deba4b-a86e-4a7c-96b7-4d9a0e0deb09"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="true">
<PkgC />
</Pkg>
<Pkg N="Application Architecture"
ID="aaf77499-5968-46e3-ab32-887545cfaedd"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="Application Architecture"
ID="68cd9da0-765d-4958-ba12-95c5ae9e2860"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="Technical Architecture"
ID="a6e957b1-f5ef-457d-bf68-ec95c9281899"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC />
</Pkg>
<Pkg N="Created on 2005/06/27 08:48:05 AM 872"
ID="555da19a-aa21-4ed4-9694-915f134d48f3"
PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
L="false" B="false">
<PkgC>
<Asc N="Links to"
ID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Private" A="false" R="true"
L="true" AT="DependsOn">
<Tag>PX=0PY=0SW=1SH=1D=8|2|1|1|1|</Tag>
<AscC>
<AsE N="(Shop - Instance 1*)"
ID="c5529649-0672-cae5-7a71-691db0d70c90"
PID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
TID="b75471b1-e5f6-455a-9857-4776c6820dff" C="true" M="1|1|1|0|0" A="None"
Nv="false" OID="b65c7879-2f74-cb4c-78a3-ca5e51774b3a" />
<AsE N="P(Shop - Instance 1*)"
ID="b65c7879-2f74-cb4c-78a3-ca5e51774b3a"
PID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
TID="445a1f81-ccf0-44f3-9a05-e4b5a722ca55" C="true" M="1|1|1|0|0" A="None"
Nv="true" OID="c5529649-0672-cae5-7a71-691db0d70c90" />
</AscC>
</Asc>
<Asc N="Buys goods - Instance"
ID="920109d7-82b3-48ea-900e-a0a0b44a7768"
PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Private" A="false" R="true"
L="true" AT="DependsOn">
<Tag>PX=0PY=0SW=1SH=1D=8|2|1|1|1|</Tag>
<AscC>
<AsE N="(Buys goods - Instance*)"
ID="361f87ab-4c73-c4f0-6ad3-176260208799"
PID="920109d7-82b3-48ea-900e-a0a0b44a7768"
TID="64de4e3c-8e80-4cda-ba9d-7782942ab0b1" C="true" M="1|1|1|0|0" A="None"
Nv="false" OID="c8cf4d1d-95df-cdce-7ccb-0486e947e2bc" />
<AsE N="P(Buys goods - Instance*)"
ID="c8cf4d1d-95df-cdce-7ccb-0486e947e2bc"
PID="920109d7-82b3-48ea-900e-a0a0b44a7768"
TID="1a8e048a-d72c-45e4-ac85-64e61dcd5594" C="true" M="1|1|1|0|0" A="None"
Nv="true" OID="361f87ab-4c73-c4f0-6ad3-176260208799" />
</AscC>
</Asc>
<Cls N="Shop - Instance 1"
ID="0dae96ef-3e78-48b3-ba27-60d735345725"
PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Public" A="false" R="false"
L="true" S="false" B="false">
<ClsC />
</Cls>
...
"Bertan ARI [MSFT]" <bertan@.online.microsoft.com> wrote in message
news:Okj2O53eFHA.2556@.TK2MSFTNGP10.phx.gbl...
> Question 1:
> There are no plans for using FOR XML PATH for SQL 2005. SQLXML will use
> FOR XML EXPLICIT as it did in earlier releases..
> Question 2:
> In Sql 2005, there are no changes in the way SQLXML generate queries.
> For the complexity brought by the elements, if you use simple type
> elements in an xsd:sequence block, we will treat them as complex type
> elements and generate a select statement for it. This is necessary to
> preserve the order of the elements. If you specify the simple type
> elements in xsd:all group, it will be treated like an attribute. On the
> other hand, there are some other cases, a simple type element might be
> interpreted as complex type elements so I would recommend using attributes
> vs elements.
> If your schema is deep and consists of several complex type elements, the
> generate FOR XML query will be also big. I couldn't understand how you can
> partially generate hierarchies and combine them. Don't you need to find
> the relevant parent Xml element to insert the Xml fragments? We would love
> to hear more about your solution.
> Question 3:
> Updategrams have support for identity-columns. You may either use
> updg:at-identity :
> http://msdn.microsoft.com/library/de...egram_375f.asp
> or use the sql:identity annoations in schema to specify the identity
> columns.
> http://msdn.microsoft.com/library/de...tions_7j03.asp
> Let us know if these solutions don't work for you.
> Question 4:
> Question 5:
> Ditto Michael here.
> --
> Bertan ARI
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:%23KzUBbTeFHA.2984@.TK2MSFTNGP15.phx.gbl...
>
|||Yes, we do support attribute groups in SqlXml. You can annotate them as
normal attributes and the annotations will be resolved based on the context
of attributegroup ref..
As far as I undertand your technique, you are executing multiple queries to
construct one Xml document.instead of executing one complex query. That
might be useful since the complexity of our FOR XML explicit queries
increases with the square of complex type elements.
Michael may talk about if SQL 2005 will offer solutions that will perform
better in deep hierarchies.
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"Joe" <morbidcamel@.msn.com> wrote in message
news:eKARm$6eFHA.3280@.TK2MSFTNGP09.phx.gbl...
>I have attached some XML sample. I cannot give you the schema because there
>is some traid secrets in there It is based on the OMG MOF model and is
>represented with interfaces and classes. Note that XSLT is used to
>transform XML to XMI etc.
> When requestig the fragments, they always have a PID (Parent Id) an so
> doing I can add it to the parent element's contents. As you can see, the
> XML can nest quite deeply. All XML are serialized into classes. The XML
> can also be serialized to a DataSet for generating Diffgrams and/or
> SqlAdaptors... The problem is, I have to add more model elements to my
> schema, and when requesting a <Pkg> (package) element there can be up to
> 12 different complex types retrieved.
> In my case a typical X-Path query looks like
> /Nms[@.ID='f5fde8f9-b359-5eca-71b6-8012ce027c32'] and for multiple elements
> /Nms[@.ID='000000ea-00e0-00fa-b0ca-d0bad000eae0' or
> @.ID='00000000-00fa-00b0-eae0-cad0bad00001' or
> @.ID='e4ecf9eb-a252-4f0b-8a47-5bf305e36d27' or
> @.ID='f5fde8f9-b359-5eca-71b6-8012ce027c33']. When the fragment is
> selected, an additional query is done to get a collection of light-weight
> "descriptors" of parent elements, which in turn is used to construct the
> parent elements if they weren't already constructed. SQLXML and .NET
> Serializer reduces the ETL time significantly. All I want though is super
> fast query times, which up until now was quite impressive. The second
> version of my framework is only due in another 6 months so there is still
> some time to find a solution and all my hopes is currently on SQL2005.
> As far as the attribute groups are involved I am refering to something
> like :
> <xs:attributeGroup name="XMI.element.att">
> <xs:annotation>
> <xs:documentation>
> XMI.element.att defines the attributes that each XML element
> that corresponds to a metamodel class must have to conform to
> the XMI specification.
> </xs:documentation>
> </xs:annotation>
> <xs:attribute name="xmi.id" type="xs:ID"/>
> <xs:attribute name="xmi.label" type="xs:string"/>
> <xs:attribute name="xmi.uuid" type="xs:string"/>
> </xs:attributeGroup>
> Can SQLXML annotations added to this attribute group be interpreted by the
> SQLXML engine.
>
> Here is sample XML requested from SQL.
> ...
> <Nms N="Synap-c" ID="00000000-00fa-00b0-eae0-cad0bad00001"
> PID="000000ea-00e0-00fa-b0ca-d0bad000eae0">
> <An>SiloFx Synap-c suite of products</An>
> <Tag>[Tank].[Synap-c]</Tag>
> <NmsC>
> <Nms N="Administrator" ID="e4ecf9eb-a252-4f0b-8a47-5bf305e36d27"
> PID="00000000-00fa-00b0-eae0-cad0bad00001">
> <An>{1}:{2}</An>
> <Tag>[Tank].[Synap-c].[Administrator]</Tag>
> <NmsC>
> <Nms N="EAE" ID="f5fde8f9-b359-5eca-71b6-8012ce027c33"
> PID="e4ecf9eb-a252-4f0b-8a47-5bf305e36d27">
> <An>SiloFx Synap-c Enterprise Architect Edition (EAE) at
> Administrator</An>
> <Tag>[Tank].[Synap-c].[Administrator].[EAE]</Tag>
> <NmsC>
> <Pkg N="Types" ID="f5fde8f9-b359-5eca-71b6-8012ce027f30"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c33" V="Internal" A="false" R="true"
> L="false" B="false">
> <An>Administrator: Synap-c EAE types used in projects
> and ontologies</An>
> <PkgC />
> </Pkg>
> <Nms N="Projects"
> ID="f5fde8f9-b359-5eca-71b6-8012ce027c31"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c33">
> <An>Administrator: Synap-c EAE types used in projects
> and ontologies</An>
> <Tag>[Tank].[Synap-c].[Administrator].[EAE].[Projects]</Tag>
> <NmsC>
> <Pkg N="Application Architecture"
> ID="54968e3e-8330-46e2-b2df-4c15e6e30c2f"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="Application Architecture"
> ID="fce438aa-25e4-4f88-bd26-0a92ac82627c"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="As Is"
> ID="9cfe0641-8e53-4586-bd72-d397fd890b28"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="SCM Organisational Structure"
> ID="57deba4b-a86e-4a7c-96b7-4d9a0e0deb09"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="true">
> <PkgC />
> </Pkg>
> <Pkg N="Application Architecture"
> ID="aaf77499-5968-46e3-ab32-887545cfaedd"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="Application Architecture"
> ID="68cd9da0-765d-4958-ba12-95c5ae9e2860"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="Technical Architecture"
> ID="a6e957b1-f5ef-457d-bf68-ec95c9281899"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC />
> </Pkg>
> <Pkg N="Created on 2005/06/27 08:48:05 AM 872"
> ID="555da19a-aa21-4ed4-9694-915f134d48f3"
> PID="f5fde8f9-b359-5eca-71b6-8012ce027c31" V="Public" A="false" R="true"
> L="false" B="false">
> <PkgC>
> <Asc N="Links to"
> ID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
> PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Private" A="false" R="true"
> L="true" AT="DependsOn">
> <Tag>PX=0PY=0SW=1SH=1D=8|2|1|1|1|</Tag>
> <AscC>
> <AsE N="(Shop - Instance 1*)"
> ID="c5529649-0672-cae5-7a71-691db0d70c90"
> PID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
> TID="b75471b1-e5f6-455a-9857-4776c6820dff" C="true" M="1|1|1|0|0" A="None"
> Nv="false" OID="b65c7879-2f74-cb4c-78a3-ca5e51774b3a" />
> <AsE N="P(Shop - Instance 1*)"
> ID="b65c7879-2f74-cb4c-78a3-ca5e51774b3a"
> PID="32c627b8-2344-4f7f-a2e6-eeabb61541af"
> TID="445a1f81-ccf0-44f3-9a05-e4b5a722ca55" C="true" M="1|1|1|0|0" A="None"
> Nv="true" OID="c5529649-0672-cae5-7a71-691db0d70c90" />
> </AscC>
> </Asc>
> <Asc N="Buys goods - Instance"
> ID="920109d7-82b3-48ea-900e-a0a0b44a7768"
> PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Private" A="false" R="true"
> L="true" AT="DependsOn">
> <Tag>PX=0PY=0SW=1SH=1D=8|2|1|1|1|</Tag>
> <AscC>
> <AsE N="(Buys goods - Instance*)"
> ID="361f87ab-4c73-c4f0-6ad3-176260208799"
> PID="920109d7-82b3-48ea-900e-a0a0b44a7768"
> TID="64de4e3c-8e80-4cda-ba9d-7782942ab0b1" C="true" M="1|1|1|0|0" A="None"
> Nv="false" OID="c8cf4d1d-95df-cdce-7ccb-0486e947e2bc" />
> <AsE N="P(Buys goods - Instance*)"
> ID="c8cf4d1d-95df-cdce-7ccb-0486e947e2bc"
> PID="920109d7-82b3-48ea-900e-a0a0b44a7768"
> TID="1a8e048a-d72c-45e4-ac85-64e61dcd5594" C="true" M="1|1|1|0|0" A="None"
> Nv="true" OID="361f87ab-4c73-c4f0-6ad3-176260208799" />
> </AscC>
> </Asc>
> <Cls N="Shop - Instance 1"
> ID="0dae96ef-3e78-48b3-ba27-60d735345725"
> PID="555da19a-aa21-4ed4-9694-915f134d48f3" V="Public" A="false" R="false"
> L="true" S="false" B="false">
> <ClsC />
> </Cls>
> ...
> "Bertan ARI [MSFT]" <bertan@.online.microsoft.com> wrote in message
> news:Okj2O53eFHA.2556@.TK2MSFTNGP10.phx.gbl...
>
|||In SQL Server 2005 you can compose FOR XML queries and we introduced the new
FOR XML PATH mode (see
http://msdn.microsoft.com/library/en.../forxml2k5.asp) that
should make it much easier to author complex hierarchies. Note however, that
while EXPLICIT mode is more complex to write and maintain, in some cases, it
may perform faster since it "XMLifies" the tree only once at the end. The
processes that create intermediate results that then are composed together
may often perform slower.
HTH
Michael
"Bertan ARI [MSFT]" <bertan@.online.microsoft.com> wrote in message
news:ONUxR$GfFHA.2156@.TK2MSFTNGP14.phx.gbl...
> Yes, we do support attribute groups in SqlXml. You can annotate them as
> normal attributes and the annotations will be resolved based on the
> context of attributegroup ref..
> As far as I undertand your technique, you are executing multiple queries
> to construct one Xml document.instead of executing one complex query. That
> might be useful since the complexity of our FOR XML explicit queries
> increases with the square of complex type elements.
> Michael may talk about if SQL 2005 will offer solutions that will perform
> better in deep hierarchies.
> --
> Bertan ARI
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "Joe" <morbidcamel@.msn.com> wrote in message
> news:eKARm$6eFHA.3280@.TK2MSFTNGP09.phx.gbl...
>
|||I thank you for the input. I am busy porting some of the logic to SQLServer
2005. I think using the XML PATH is going to do the trick for me.
This will mean I don't have to have views to get it into the right format,
some of the views uses the same tables, thus I can use reuse one table in
my query,
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:O7AmR3NfFHA.3780@.TK2MSFTNGP10.phx.gbl...
> In SQL Server 2005 you can compose FOR XML queries and we introduced the
> new FOR XML PATH mode (see
> http://msdn.microsoft.com/library/en.../forxml2k5.asp) that
> should make it much easier to author complex hierarchies. Note however,
> that while EXPLICIT mode is more complex to write and maintain, in some
> cases, it may perform faster since it "XMLifies" the tree only once at the
> end. The processes that create intermediate results that then are composed
> together may often perform slower.
> HTH
> Michael
> "Bertan ARI [MSFT]" <bertan@.online.microsoft.com> wrote in message
> news:ONUxR$GfFHA.2156@.TK2MSFTNGP14.phx.gbl...
>
|||Cool, thanks. Feel free to share your feedback on how it went and how the
FOR XML PATH works.
Best regards
Michael
"Joe" <morbidcamel@.msn.com> wrote in message
news:eZxGtU4hFHA.576@.tk2msftngp13.phx.gbl...
>I thank you for the input. I am busy porting some of the logic to SQLServer
>2005. I think using the XML PATH is going to do the trick for me.
> This will mean I don't have to have views to get it into the right format,
> some of the views uses the same tables, thus I can use reuse one table in
> my query,
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:O7AmR3NfFHA.3780@.TK2MSFTNGP10.phx.gbl...
>

Annotated Schema Problem for BulkLoad

Hi all,
There was a post earlier ("Schema Annotation on Element",
2003-09-02) about not wanting to map a complex-type element to a
database BUT wanting to map one or more of its attributes to a
database. Meaning for something like this:
<xsd:element name="CompanyInformation"
sql:relation="AnnualMultexFund" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Company" sql:is-constant="1">
<xsd:complexType>
<xsd:attribute name="Name" type="xsd:string"
sql:field="name" />
<xsd:attribute name="ActiveStatus"
type="xsd:unsignedByte" sql:mapped="false" />
</xsd:complexType>
</xsd:element>
...
What would you place instead of sql:is-constant="1" for "Company",
which doesn't work because if you do that then you can no longer
process its attributes?
In other words, I want "Name" without actually creating another
column for "Company."
Actually, even doing something like
<xsd:element name="Company" sql:field="name_t">
won't work with the error: "the annotation 'field' on the empty content
element 'Company' is not supported" This is an error because "Company" does
not have anything but attributes.
"Sam" <refracti0n@.yahoo.com> wrote in message
news:1c2a5727.0408161409.79652eac@.posting.google.c om...
> Hi all,
> There was a post earlier ("Schema Annotation on Element",
> 2003-09-02) about not wanting to map a complex-type element to a
> database BUT wanting to map one or more of its attributes to a
> database. Meaning for something like this:
> <xsd:element name="CompanyInformation"
> sql:relation="AnnualMultexFund" >
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Company" sql:is-constant="1">
> <xsd:complexType>
> <xsd:attribute name="Name" type="xsd:string"
> sql:field="name" />
> <xsd:attribute name="ActiveStatus"
> type="xsd:unsignedByte" sql:mapped="false" />
> </xsd:complexType>
> </xsd:element>
> ...
> What would you place instead of sql:is-constant="1" for "Company",
> which doesn't work because if you do that then you can no longer
> process its attributes?
> In other words, I want "Name" without actually creating another
> column for "Company."
|||A suggestion from Irwin:
He could just put the sql:relation annotation on the Company element and
make CompanyInformation constant.
HTH
Michael
"Sam Chou" <sam.chou@.acinvestors.net> wrote in message
news:uZgwrB%23gEHA.3928@.TK2MSFTNGP11.phx.gbl...
> Actually, even doing something like
> <xsd:element name="Company" sql:field="name_t">
> won't work with the error: "the annotation 'field' on the empty content
> element 'Company' is not supported" This is an error because "Company"
> does
> not have anything but attributes.
> "Sam" <refracti0n@.yahoo.com> wrote in message
> news:1c2a5727.0408161409.79652eac@.posting.google.c om...
>

Annotated Schema Not Working

When I attempt to use Annotated Schemas, either the
Northwind examples or one's I have written myself they
will not run. If I run templates that don't use the
Annotated Schemas or URL queries everything works fine,
but, the Annotated Schemas don't. The errors that come
back are page cannot be found when I add an XML Path to
the URL query to the annotated schema. Can anybody help,
I have tried to get this working for a couple of weeks?
I am about ready to give up.
A couple of things to check (assuming you're talking about using a schema
through an IIS virtual root):
Have you enabled XPath Queries in the virtual root?
Have you put the schema in a virtual name of type "schema"?
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
www.microsoft.com/mspress/books/6137.asp
"Mike" <mojodallas@.msn.com> wrote in message
news:1c5f01c4465e$5a415e00$7d02280a@.phx.gbl...
> When I attempt to use Annotated Schemas, either the
> Northwind examples or one's I have written myself they
> will not run. If I run templates that don't use the
> Annotated Schemas or URL queries everything works fine,
> but, the Annotated Schemas don't. The errors that come
> back are page cannot be found when I add an XML Path to
> the URL query to the annotated schema. Can anybody help,
> I have tried to get this working for a couple of weeks?
> I am about ready to give up.

Friday, February 24, 2012

Annotated Schema Not Working

When I attempt to use Annotated Schemas, either the
Northwind examples or one's I have written myself they
will not run. If I run templates that don't use the
Annotated Schemas or URL queries everything works fine,
but, the Annotated Schemas don't. The errors that come
back are page cannot be found when I add an XML Path to
the URL query to the annotated schema. Can anybody help,
I have tried to get this working for a couple of weeks?
I am about ready to give up.
A couple of things to check (assuming you're talking about using a schema
through an IIS virtual root):
Have you enabled XPath Queries in the virtual root?
Have you put the schema in a virtual name of type "schema"?
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
www.microsoft.com/mspress/books/6137.asp
"Mike" <mojodallas@.msn.com> wrote in message
news:1c5f01c4465e$5a415e00$7d02280a@.phx.gbl...
> When I attempt to use Annotated Schemas, either the
> Northwind examples or one's I have written myself they
> will not run. If I run templates that don't use the
> Annotated Schemas or URL queries everything works fine,
> but, the Annotated Schemas don't. The errors that come
> back are page cannot be found when I add an XML Path to
> the URL query to the annotated schema. Can anybody help,
> I have tried to get this working for a couple of weeks?
> I am about ready to give up.

annotated schema and bulk loading into multiple tables...

Hi guys,
I'm trying to get XML data loaded into a set of tables using bulk load. The
child tables also have an XML column where I want to store portions of the
XML.
So far the I've got it correctly inserting data into the parent, and able to
insert the correct amount of rows in the child tables, but the data in the
child tables is empty... The child data is an identity column, a foreign key
pointing back to the parent row (empty!), and an XML data column holding the
contents of the xml fragment (also empty!).
Any help would be greatly appreciated!
Thanks.
Daniel.
Below is where I've got to so far...
SQL definitions for my parent table and a child table:
----
CREATE TABLE [dbo].[Foo](
[Foo_PK] [int] IDENTITY(1,1) NOT NULL,
[StartDateTime] [datetime] NULL,
[EndDateTime] [datetime] NULL,
CONSTRAINT [PK_Foo] PRIMARY KEY CLUSTERED
(
[Foo_PK] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[ChildOfFoo](
[ChildOfFoo_PK] [int] IDENTITY(1,1) NOT NULL,
[Foo_FK] [int] NULL,
[Data] [xml] NULL,
CONSTRAINT [PK_ChildOfFoo] PRIMARY KEY CLUSTERED
(
[ChildOfFoo_PK] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Here's the annotated XSD:
----
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:annotation>
<xs:appinfo>
<!-- RELATIONSHIP FOR CONNECTING THE CHILD KEY TO THE PARENT
INDEX -->
<sql:relationship name="HeaderWash"
parent="Foo"
parent-key="Foo_PK"
child="ChildOfFoo"
child-key="Foo_FK" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<!-- HEADER XML TO FOO TABLE -->
<xs:element name="Header"
sql:relation="Foo"
sql:key-fields="Foo_PK">
<xs:complexType>
<xs:sequence>
<xs:element name="Foo_PK" type="xs:integer"
minOccurs="0"
default="0" sql:identity="ignore"/>
<xs:element name="StartDateTime"
type="xs:dateTime" />
<xs:element name="EndDateTime"
type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- CHILD XML TO CHILD OF FOO TABLE -->
<xs:element name="Children" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Wash"
sql:relation="ChildOfFoo"
sql:key-fields="ChildOfFoo_PK"
sql:relationship="HeaderWash">
<xs:complexType>
<xs:sequence>
<xs:element name="ChildOfFoo_PK"
type="xs:string"
minOccurs="0"
default="0" sql:identity="ignore" />
<xs:element name="Foo_FK"
type="xs:string" />
<xs:element name="Wash"
sql:field="Data" sql:datatype="xml" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And finally, (thanks for your patience!), a sample of XML data...
----
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Root>
<Header>
<StartDateTime>15 Jun 2007 08:07:00</StartDateTime>
<EndDateTime>15 Jun 2007 09:12:00</EndDateTime>
</Header>
<Children>
<!-- EACH CHILDOFFOO CREATE'S A ROW IN CHILDOFFOO TABLE
AND ALSO IS INSERTED INTO DATA XML COLUMN.
CAN CONTAIN <ChildOFFoo>, BUT BETTER TO JUST HAVE
INNER TEXT XML FRAGMENT...
-->
<ChildOfFoo>
<Phasetime>02:00</Phasetime>
<Heated>No</Heated>
</ChildOfFoo>
<ChildOfFoo>
<Quantityinjected>22.8 ml</Quantityinjected>
<Lowerlimit>61.1 ml</Lowerlimit>
<Upperlimit>82.7 ml</Upperlimit>
</ChildOfFoo>
<ChildOfFoo>
<Watertype>Cold water</Watertype>
<Numberofstages>1</Numberofstages>
</ChildOfFoo>
<ChildOfFoo>
<Quantityinjected>137.6 ml</Quantityinjected>
<Lowerlimit>122.3 ml</Lowerlimit>
<Upperlimit>165.4 ml</Upperlimit>
</ChildOfFoo>
<ChildOfFoo>
<Circulationpressure>Detected</Circulationpressure>
</ChildOfFoo>
<ChildOfFoo>
<Heated>No</Heated>
<Circulationpressure>Detected</Circulationpressure>
</ChildOfFoo>
</Children>
</Root>In case anyone elase wants this solution... The schema is modified as such:
1. When referencing a foreign key (as in the relationship) it needs to stay
in scope from when it is initially populated by the parent table, to each
time it is used. If you get a foreign key of null, you are most probably
using the FK out of scope.
2. Use the sql:overflow-field="<MyXmlColumn>" in the element that relates to
the table you want to store as XML. The sql:overflow-field field takes all
unreferenced XML in that node and stuffs it into the field you specify.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:annotation>
<xs:appinfo>
<!-- RELATIONSHIP FOR CONNECTING THE CHILD KEY TO THE PARENT
INDEX -->
<sql:relationship name="HeaderWash"
parent="Foo"
parent-key="Foo_PK"
child="ChildOfFoo"
child-key="Foo_FK" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<!-- HEADER XML ELEMENTS TO FOO TABLE -->
<xs:element name="Foo_PK" type="xs:integer" minOccurs="0"
default="0" sql:identity="ignore"/>
<xs:element name="StartDateTime" type="xs:dateTime" />
<xs:element name="EndDateTime" type="xs:dateTime" />
<!-- CHILD XML TO CHILD OF FOO TABLE -->
<xs:element name="Children" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Wash"
sql:relation="ChildOfFoo"
sql:key-fields="ChildOfFoo_PK"
sql:relationship="HeaderWash"
sql:overflow-field="Data">
<xs:complexType>
<xs:sequence>
<xs:element name="ChildOfFoo_PK"
type="xs:string"
minOccurs="0" default="0"
sql:identity="ignore" />
<xs:element name="Foo_FK"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

> <?xml version="1.0" encoding="utf-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xs:annotation>
> <xs:appinfo>
> <!-- RELATIONSHIP FOR CONNECTING THE CHILD KEY TO THE PARENT
> INDEX -->
> <sql:relationship name="HeaderWash"
> parent="Foo"
> parent-key="Foo_PK"
> child="ChildOfFoo"
> child-key="Foo_FK" />
> </xs:appinfo>
> </xs:annotation>
> <xs:element name="Root" sql:is-constant="1">
> <xs:complexType>
> <xs:sequence>
> <!-- HEADER XML TO FOO TABLE -->
> <xs:element name="Header"
> sql:relation="Foo"
> sql:key-fields="Foo_PK">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Foo_PK" type="xs:integer"
> minOccurs="0"
> default="0" sql:identity="ignore"/>
> <xs:element name="StartDateTime"
> type="xs:dateTime" />
> <xs:element name="EndDateTime"
> type="xs:dateTime" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <!-- CHILD XML TO CHILD OF FOO TABLE -->
> <xs:element name="Children" sql:is-constant="1">
> <xs:complexType>
> <xs:sequence>
> <xs:element maxOccurs="unbounded" name="Wash"
> sql:relation="ChildOfFoo"
> sql:key-fields="ChildOfFoo_PK"
> sql:relationship="HeaderWash">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="ChildOfFoo_PK"
> type="xs:string"
> minOccurs="0"
> default="0" sql:identity="ignore" />
> <xs:element name="Foo_FK"
> type="xs:string" />
> <xs:element name="Wash"
> sql:field="Data" sql:datatype="xml" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
"Daniel Bass" <danREMOVEbass@.blueCAPSbottle.comFIRST> wrote in message
news:%23gNnsRHxHHA.600@.TK2MSFTNGP05.phx.gbl...
> Hi guys,
> I'm trying to get XML data loaded into a set of tables using bulk load.
> The child tables also have an XML column where I want to store portions of
> the XML.
> So far the I've got it correctly inserting data into the parent, and able
> to insert the correct amount of rows in the child tables, but the data in
> the child tables is empty... The child data is an identity column, a
> foreign key pointing back to the parent row (empty!), and an XML data
> column holding the contents of the xml fragment (also empty!).
> Any help would be greatly appreciated!
> Thanks.
> Daniel.
>
>
> Below is where I've got to so far...
> SQL definitions for my parent table and a child table:
> ----
> CREATE TABLE [dbo].[Foo](
> [Foo_PK] [int] IDENTITY(1,1) NOT NULL,
> [StartDateTime] [datetime] NULL,
> [EndDateTime] [datetime] NULL,
> CONSTRAINT [PK_Foo] PRIMARY KEY CLUSTERED
> (
> [Foo_PK] ASC
> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
> OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
> ) ON [PRIMARY]
> CREATE TABLE [dbo].[ChildOfFoo](
> [ChildOfFoo_PK] [int] IDENTITY(1,1) NOT NULL,
> [Foo_FK] [int] NULL,
> [Data] [xml] NULL,
> CONSTRAINT [PK_ChildOfFoo] PRIMARY KEY CLUSTERED
> (
> [ChildOfFoo_PK] ASC
> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
> OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
> ) ON [PRIMARY]
>
>
> Here's the annotated XSD:
> ----
> <?xml version="1.0" encoding="utf-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xs:annotation>
> <xs:appinfo>
> <!-- RELATIONSHIP FOR CONNECTING THE CHILD KEY TO THE PARENT
> INDEX -->
> <sql:relationship name="HeaderWash"
> parent="Foo"
> parent-key="Foo_PK"
> child="ChildOfFoo"
> child-key="Foo_FK" />
> </xs:appinfo>
> </xs:annotation>
> <xs:element name="Root" sql:is-constant="1">
> <xs:complexType>
> <xs:sequence>
> <!-- HEADER XML TO FOO TABLE -->
> <xs:element name="Header"
> sql:relation="Foo"
> sql:key-fields="Foo_PK">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Foo_PK" type="xs:integer"
> minOccurs="0"
> default="0" sql:identity="ignore"/>
> <xs:element name="StartDateTime"
> type="xs:dateTime" />
> <xs:element name="EndDateTime"
> type="xs:dateTime" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <!-- CHILD XML TO CHILD OF FOO TABLE -->
> <xs:element name="Children" sql:is-constant="1">
> <xs:complexType>
> <xs:sequence>
> <xs:element maxOccurs="unbounded" name="Wash"
> sql:relation="ChildOfFoo"
> sql:key-fields="ChildOfFoo_PK"
> sql:relationship="HeaderWash">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="ChildOfFoo_PK"
> type="xs:string"
> minOccurs="0"
> default="0" sql:identity="ignore" />
> <xs:element name="Foo_FK"
> type="xs:string" />
> <xs:element name="Wash"
> sql:field="Data" sql:datatype="xml" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> And finally, (thanks for your patience!), a sample of XML data...
> ----
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <Root>
> <Header>
> <StartDateTime>15 Jun 2007 08:07:00</StartDateTime>
> <EndDateTime>15 Jun 2007 09:12:00</EndDateTime>
> </Header>
> <Children>
> <!-- EACH CHILDOFFOO CREATE'S A ROW IN CHILDOFFOO TABLE
> AND ALSO IS INSERTED INTO DATA XML COLUMN.
> CAN CONTAIN <ChildOFFoo>, BUT BETTER TO JUST HAVE
> INNER TEXT XML FRAGMENT...
> -->
> <ChildOfFoo>
> <Phasetime>02:00</Phasetime>
> <Heated>No</Heated>
> </ChildOfFoo>
> <ChildOfFoo>
> <Quantityinjected>22.8 ml</Quantityinjected>
> <Lowerlimit>61.1 ml</Lowerlimit>
> <Upperlimit>82.7 ml</Upperlimit>
> </ChildOfFoo>
> <ChildOfFoo>
> <Watertype>Cold water</Watertype>
> <Numberofstages>1</Numberofstages>
> </ChildOfFoo>
> <ChildOfFoo>
> <Quantityinjected>137.6 ml</Quantityinjected>
> <Lowerlimit>122.3 ml</Lowerlimit>
> <Upperlimit>165.4 ml</Upperlimit>
> </ChildOfFoo>
> <ChildOfFoo>
> <Circulationpressure>Detected</Circulationpressure>
> </ChildOfFoo>
> <ChildOfFoo>
> <Heated>No</Heated>
> <Circulationpressure>Detected</Circulationpressure>
> </ChildOfFoo>
> </Children>
> </Root>
>

Annotated Mapping Schema

I have a stored procedure that uses the FOR XML EXPLICIT mode to return an xml view of my data. I then insert this xml into another table.
Instead of writing complicated T-SQL with the FOR XML EXPLICIT mode I'd like to use an xsd schema, however I can't find examples that let you apply the transformation in a stored procedure / test it in Query Analyzer. All the examples I've found involve m
apping the schema in the URL or using a SqlXmlCommand object.
Any help would be very much appreciated!
Cheers,
Paul
Mapping Schemas are a client-side technology - actually, they just generate
FOR XML EXPLICIT statements on the server (you can see this by running a
trace when retrieving data with a schema). As such, there's no way to
reference them from within a T-SQL sproc. Sorry!
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
www.microsoft.com/mspress/books/6137.asp
"Paul Bibby" <Paul Bibby@.discussions.microsoft.com> wrote in message
news:4B7E0882-5EED-4A7F-987D-125262683276@.microsoft.com...
I have a stored procedure that uses the FOR XML EXPLICIT mode to return an
xml view of my data. I then insert this xml into another table.
Instead of writing complicated T-SQL with the FOR XML EXPLICIT mode I'd like
to use an xsd schema, however I can't find examples that let you apply the
transformation in a stored procedure / test it in Query Analyzer. All the
examples I've found involve mapping the schema in the URL or using a
SqlXmlCommand object.
Any help would be very much appreciated!
Cheers,
Paul

Thursday, February 9, 2012

Analysis Services 2005 Design Challenge

Hi to all, I’m designing a SSAS 2005 cube based on an Oracle data source

We have a classical star schema with several millions of records into the fact table.

Now everything goes fine since dimensions are quite small (the greatest one has 100000 records), but users are asking me the possibility of view also more detailed data such order_number, client fiscal code, etc…and this data it has been stored into the fact table as a fact degenerate dimension.

Now I don’t want to load into the cube this degenerate dimension because it contains as I said too many records.

I was thinking to drill-through functionality (achieved setting the storage mode of the degenerate dimension to ROLAP) but after several tests it seems very very slow (it launches queries that incredibly big grouping all the dimensions and all the fields of the fact table or other times launches several heavy queries catching all the distinct values of order_number, client fiscal code, etc…) and some times the client itself (OWC) hangs and I have to kill it.

Note that these tests are done on the development environment where the fact table contains more or less only 70000 records!

I tried also to query directly this degenerate dimension (without drill-through) but the results are the same.

Any suggestions?

Thanks.

Alberto

Try using MOLAP dimensions. They should scale pretty well in AS2005.

You should be able to handle several milion members with MOLAP dimensions.

Hope that helps.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.