Showing posts with label node. Show all posts
Showing posts with label node. Show all posts

Tuesday, March 27, 2012

Extra xml node

This is in sql 2005
I have a query that is returning a set of rows each with one xml field
row1 -<apple></apple>
row3 -<orange></orange>
row2-<grape></grape>
I want the output to look like this
<fruits>
<apple></apple>
<orange></orange>
<grape></grape>
</fruits>
However when I use FOR XML AUTO, root(''Fruits'')
<fruits>
<fruit><apple></apple></fruit>
<fruit><orange></orange></fruit>
<fruit> <grape></grape></fruit>
</fruits>
How do I remove the extra fruit element?
ENDHello Hyper,
Try using a FOR XML PATH query instead, ala for xml path (''),root('fruits')
,type
Thanks!
Kent

> This is in sql 2005
> I have a query that is returning a set of rows each with one xml field
> row1 -<apple></apple>
> row3 -<orange></orange>
> row2-<grape></grape>
> I want the output to look like this
> <fruits>
> <apple></apple>
> <orange></orange>
> <grape></grape>
> </fruits>
> However when I use FOR XML AUTO, root(''Fruits'')
> <fruits>
> <fruit><apple></apple></fruit>
> <fruit><orange></orange></fruit>
> <fruit> <grape></grape></fruit>
> </fruits>
> How do I remove the extra fruit element?
> END
>
Thank you,
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/

Wednesday, March 7, 2012

Expression Constants

When I edit an expression for a textbox, I notice a 'Constants' node in the
tree along with Globals, etc. How/Where do i define the constants that will
show up here? For example, i would like to define a path to a server in a
constant, be able to use it for various expressions, and only have to change
it in one place when i move my report from dev/staging/production.JeffW wrote:
> When I edit an expression for a textbox, I notice a 'Constants' node
in the
> tree along with Globals, etc. How/Where do i define the constants
that will
> show up here? For example, i would like to define a path to a server
in a
> constant, be able to use it for various expressions, and only have to
change
> it in one place when i move my report from dev/staging/production.
You can't define constants to show up in this area. This is for
pre-defined constants. To create a constant to use, you can create one
with the VB.NET syntax in the code section. To see constants in this
area, you can (for example) go to the properties of a text box and
click on the expression button (fx) of a property that uses constants,
for example most of the alignment properties have constants that you
can use here.
Dan|||Thanks Dan. That clears it up
"dan" wrote:
> JeffW wrote:
> > When I edit an expression for a textbox, I notice a 'Constants' node
> in the
> > tree along with Globals, etc. How/Where do i define the constants
> that will
> > show up here? For example, i would like to define a path to a server
> in a
> > constant, be able to use it for various expressions, and only have to
> change
> > it in one place when i move my report from dev/staging/production.
> You can't define constants to show up in this area. This is for
> pre-defined constants. To create a constant to use, you can create one
> with the VB.NET syntax in the code section. To see constants in this
> area, you can (for example) go to the properties of a text box and
> click on the expression button (fx) of a property that uses constants,
> for example most of the alignment properties have constants that you
> can use here.
> Dan
>