Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Wednesday, March 28, 2012

How to remove item from a solution

I added something by mistake! If I delete it it gives me an `are you sure?` message that makes me think it'll actually delete the file from the hard drive. As I've accidentally added something from SQL Server (I was trying to add a database and got carried away) I don't think that's such a good idea. I've googled and found this:

http://msdn2.microsoft.com/en-us/library/1ee8zw5t(VS.80).aspx


which helpfully states:

--

To remove a solution item

    InSolution Explorer, select the item you want to remove.

    On theEdit menu, chooseRemove.

--

which would be great, if only the Edit menu had a remove option.

Any ideas?

I know for me, with vs2005, if I remove a project from my solution, the project does not get deleted, just the link to it.

|||

You're right! Thanks! (But where are the menu items referred to on that web page?)

Friday, March 9, 2012

How to read the error message #Error.

Hi,
My custom code i have written try catch end try block and in the catch
section just i returned the err.description. But locally it was working fine.
Once deployed it was not working fine. just showing #error. Any help would
be appreciated.
Regards,
Sri.On Jun 25, 2:36 pm, Sriman <Sri...@.discussions.microsoft.com> wrote:
> Hi,
> My custom code i have written try catch end try block and in the catch
> section just i returned the err.description. But locally it was working fine.
> Once deployed it was not working fine. just showing #error. Any help would
> be appreciated.
> Regards,
> Sri.
This is a long shot, but you could try checking the Event Viewer:
Application Errors log -or- you could try adjusting the Custom Errors
section of the Reports or ReportServer virtual directories (via: Right-
click -> Properties -> Custom Errors tab) -or- add custom code to the
report (via: Layout view -> Report drop-down -> Report Properties... -
> Code). Sorry that I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultant

Wednesday, March 7, 2012

how to read a xsd value

Hello (this is a frenchy message so : a very bad english...(
will be able to forgive me? )) :)
how then I to read the contents of a file xsd and to recover the value of
nodes and their children?
this program work but only for the principal node but not for children
if my shcema content
<xsd:element name="COMMENT">
<xsd:element name="CONSOMMATION">
<xsd:element name="OPTIONS">
<xsd:element name="PERSONNAL">
<xsd:element name="items">
my program write
COMMENT
CONSOMMATION
OPTIONS
PERSONNAL
items
but not
<xsd:element name="city" type="xsd:string" />
<xsd:element name="higtway" type="xsd:string" />
<xsd:element name="mix" type="xsd:string" />
in <xsd:element name="CONSOMMATION">
'first i chose a schema in a drop
'and i read the shcema in sql server 2005 like this
Dim cmdSql As String
cmdSql = "SELECT XML_SCHEMA_NAMESPACE(sch.name, xsd.name) FROM
sys.xml_schema_collections AS xsd "
cmdSql = cmdSql + "JOIN sys.schemas AS sch ON xsd.schema_id = sch.schema_id
WHERE xsd.name = '"
cmdSql = cmdSql + Session("dropSelect") + "'" ' drop select contents the
schema name in my sql server 2005
Dim xml As SqlXml
Dim xmlRdr As System.Xml.XmlReader
Dim conn As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("cs_vehicule").Connecti
onString)
conn.Open()
Dim cmd As SqlCommand = New SqlCommand(cmdSql, conn)
Dim rdr As SqlDataReader = cmd.ExecuteReader
While rdr.Read
xml = rdr.GetSqlXml(0) ' GetSqlXml(0) = number of row where i can read xml
data
xmlRdr = xml.CreateReader
While xmlRdr.Read
Dim schema As XmlSchema
schema = XmlSchema.Read(xmlRdr, Nothing)
LblSchema.Text = schema.Id
Dim schemaObject As XmlSchemaObject
For Each schemaObject In schema.Items
If schemaObject.GetType() Is GetType(XmlSchemaElement) Then
'Dim ElementType As XmlSchemaElement = CType(schemaObject,
XmlSchemaElement)
'LblSchema.Text = LblSchema.Text + ElementType.Name.ToString + "<br/>"
Dim schemaSequence As XmlSchemaSequence
For Each schemaSequence In schema.Elements
Dim SequenceType As XmlSchemaSequence = CType(schemaObject,
XmlSchemaSequence)
LblSchema.Text = LblSchema.Text + SequenceType.Items.ToString(+"<br/>")
Next
End If
Next schemaObject
End While
xmlRdr.Close()
End While
rdr.Close()
conn.Close()
Thank youI am less concerned about your french influence than the VB code ;-)
Why don't you just use XQuery in the database to generate your output?
SELECT XML_SCHEMA_NAMESPACE(sch.name, xsd.name).query('for $n in
/xs:schema/xs:element/@.name return data($n)') FROM
sys.xml_schema_collections AS xsd
JOIN sys.schemas AS sch ON xsd.schema_id = sch.schema_id
WHERE xsd.name = @.dropSelect -- @.dropSelect is a parameter you pass from
your client program.
Best regards
Michael
"Helter Skelter" <nowhere-man@.apple.uk> wrote in message
news:45b88440$0$27410$ba4acef3@.news.orange.fr...
> Hello (this is a frenchy message so : a very bad english...(
> will be able to forgive me? )) :)
> how then I to read the contents of a file xsd and to recover the value of
> nodes and their children?
> this program work but only for the principal node but not for children
> if my shcema content
> <xsd:element name="COMMENT">
> <xsd:element name="CONSOMMATION">
> <xsd:element name="OPTIONS">
> <xsd:element name="PERSONNAL">
> <xsd:element name="items">
> my program write
> COMMENT
> CONSOMMATION
> OPTIONS
> PERSONNAL
> items
> but not
> <xsd:element name="city" type="xsd:string" />
> <xsd:element name="higtway" type="xsd:string" />
> <xsd:element name="mix" type="xsd:string" />
> in <xsd:element name="CONSOMMATION">
>
> 'first i chose a schema in a drop
> 'and i read the shcema in sql server 2005 like this
> Dim cmdSql As String
> cmdSql = "SELECT XML_SCHEMA_NAMESPACE(sch.name, xsd.name) FROM
> sys.xml_schema_collections AS xsd "
> cmdSql = cmdSql + "JOIN sys.schemas AS sch ON xsd.schema_id =
> sch.schema_id
> WHERE xsd.name = '"
> cmdSql = cmdSql + Session("dropSelect") + "'" ' drop select contents the
> schema name in my sql server 2005
> Dim xml As SqlXml
> Dim xmlRdr As System.Xml.XmlReader
> Dim conn As SqlConnection = New
> SqlConnection(ConfigurationManager.ConnectionStrings("cs_vehicule").Connec
tionString)
> conn.Open()
> Dim cmd As SqlCommand = New SqlCommand(cmdSql, conn)
> Dim rdr As SqlDataReader = cmd.ExecuteReader
> While rdr.Read
> xml = rdr.GetSqlXml(0) ' GetSqlXml(0) = number of row where i can read
> xml data
> xmlRdr = xml.CreateReader
> While xmlRdr.Read
> Dim schema As XmlSchema
> schema = XmlSchema.Read(xmlRdr, Nothing)
> LblSchema.Text = schema.Id
> Dim schemaObject As XmlSchemaObject
> For Each schemaObject In schema.Items
> If schemaObject.GetType() Is GetType(XmlSchemaElement) Then
> 'Dim ElementType As XmlSchemaElement = CType(schemaObject,
> XmlSchemaElement)
> 'LblSchema.Text = LblSchema.Text + ElementType.Name.ToString + "<br/>"
> Dim schemaSequence As XmlSchemaSequence
> For Each schemaSequence In schema.Elements
> Dim SequenceType As XmlSchemaSequence = CType(schemaObject,
> XmlSchemaSequence)
> LblSchema.Text = LblSchema.Text +
> SequenceType.Items.ToString(+"<br/>")
> Next
> End If
> Next schemaObject
> End While
> xmlRdr.Close()
> End While
> rdr.Close()
> conn.Close()
>
> Thank you
>|||Dear Michael
thank you for your humour and the interest which you carry to my work.
I build a super market which will be able to sell televisions, cars,
computers, vegetables and shirts (laughter).
My base "sql server" contains a single table for all these articles.
Only one fields will be different: that of the characteristics (in xml).
So I have different diagrams xml according to item (to be able to compare
them). I currently have 27 possible diagrams !
The characteristics of a television are different from a car.
When I read a recording, fields indicates to me which is the diagram that I
must associate for good read the fields of the characteristics.
The diagram xsd will be useful to me for the validation of a new seizure or
a modification.
It must also serve to me to create on my Web page the "labels" and "textbox"
during creation as the recording to fill my fields xml of the
characteristics.
When I create a new article, I must say:
1) which is its diagram (dropdownlist)
2) to read which are the fields contained in the diagram
3) to create its fields on my page
example:
video chart
--processor speed
--RAM
mother board
--chipset
--a number of slot
When I create a new article, it is by reading the diagram that I will find
which are the fields to be created.
For this reason I read the diagram in "sql server 2005"
Let us be us always friendly (laughter ) ?
A splendid time is guaranteed for all !
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> a crit dans le message de
news: %23ApgopPQHHA.4992@.TK2MSFTNGP04.phx.gbl...
>I am less concerned about your french influence than the VB code ;-)
> Why don't you just use XQuery in the database to generate your output?
> SELECT XML_SCHEMA_NAMESPACE(sch.name, xsd.name).query('for $n in
> /xs:schema/xs:element/@.name return data($n)') FROM
> sys.xml_schema_collections AS xsd
> JOIN sys.schemas AS sch ON xsd.schema_id = sch.schema_id
> WHERE xsd.name = @.dropSelect -- @.dropSelect is a parameter you pass from
> your client program.
> Best regards
> Michael
> "Helter Skelter" <nowhere-man@.apple.uk> wrote in message
> news:45b88440$0$27410$ba4acef3@.news.orange.fr...
>
>

Friday, February 24, 2012

How to query XML

This is the content of one of the rows of the Message column.
<ERINOT VersionMajor="1" VersionMinor="1"
xmlns:mstns="http://tempuri.org/Dataset1.xsd">
<MessageId>
<SenderId>900013581</SenderId>
<ReceiverId>900013574</ReceiverId>
<GenerationDateTime>2005-09-15T05:54:01</GenerationDateTime>
<MessageType>PAS</MessageType>
<MessageNo>22412022</MessageNo>
<MessageFunction>9</MessageFunction>
</MessageId>
</ERINOT>
How can I query let's say the MessageType?
I tried this:
SET ARITHABORT ON
SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType)[0]',
'varchar(40)') as MType
FROM ERINOT
But this does not work
Any suggestion is higly appreciated,
Erik
E!k Visser wrote:
> This is the content of one of the rows of the Message column.
> <ERINOT VersionMajor="1" VersionMinor="1"
> xmlns:mstns="http://tempuri.org/Dataset1.xsd">
> <MessageId>
> <SenderId>900013581</SenderId>
> <ReceiverId>900013574</ReceiverId>
> <GenerationDateTime>2005-09-15T05:54:01</GenerationDateTime>
> <MessageType>PAS</MessageType>
> <MessageNo>22412022</MessageNo>
> <MessageFunction>9</MessageFunction>
> </MessageId>
> </ERINOT>
> How can I query let's say the MessageType?
> I tried this:
> SET ARITHABORT ON
> SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType)[0]',
> 'varchar(40)') as MType
> FROM ERINOT
@.MessageType selects an attribute while you have a MessageType element.
Furthermore with XPath/XQuery the first node has index 1 not 0 so use
(/ERINOT/MessageId/MessageType)[1]

Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
|||Or if your XML is not constrained by a schema, the following is more
efficient by directly accessing the text node:
(/ERINOT/MessageId/MessageType/text())[1]
Best regards
Michael
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
> E!k Visser wrote:
> @.MessageType selects an attribute while you have a MessageType element.
> Furthermore with XPath/XQuery the first node has index 1 not 0 so use
> (/ERINOT/MessageId/MessageType)[1]
>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/
|||Michael,
Thanks for your contribution, but I do not understand what would be the
difference.
What would the query look like in you scenario?
Perhaps good to know I might be limited by the fact I have to use ADO to
access the database.
Erik
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
news:uexsXRpsHHA.412@.TK2MSFTNGP04.phx.gbl...
> Or if your XML is not constrained by a schema, the following is more
> efficient by directly accessing the text node:
> (/ERINOT/MessageId/MessageType/text())[1]
> Best regards
> Michael
> "Martin Honnen" <mahotrash@.yahoo.de> wrote in message
> news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
>
|||Martin,
"Martin Honnen" <mahotrash@.yahoo.de> schreef in bericht
news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
> E!k Visser wrote:
> @.MessageType selects an attribute while you have a MessageType element.
> Furthermore with XPath/XQuery the first node has index 1 not 0 so use
> (/ERINOT/MessageId/MessageType)[1]
Thank you very much! This works like a charm.
But no I have another question, how can I list all nodes?
This could be the XML:
<ContainerMatrixes>
<ContainerMatrix>
<ContRange>RNG20</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG30</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG40</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
</ContainerMatrixes>
And now I Like to query the ContRange and have three rows as result. It
should be as generic as possible, as in this case a ship usually carries
more than three containers...
Any suggestions?
Erik
|||E!k Visser wrote:

> But no I have another question, how can I list all nodes?
> This could be the XML:
> <ContainerMatrixes>
> <ContainerMatrix>
> <ContRange>RNG20</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG30</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG40</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> </ContainerMatrixes>
> And now I Like to query the ContRange and have three rows as result.
Here is an example, use the nodes method to shred the XML into rows,
then use one of the methods query or value to extract values.
DECLARE @.x XML;
SET @.x = ' <ContainerMatrixes>
<ContainerMatrix>
<ContRange>RNG20</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG30</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG40</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
</ContainerMatrixes>';
SELECT T.ContRange.query('.')
FROM @.x.nodes('ContainerMatrixes/ContainerMatrix/ContRange') AS
T(ContRange);
Result is
<ContRange>RNG20</ContRange>
<ContRange>RNG30</ContRange>
<ContRange>RNG40</ContRange>

Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
|||Martin,

> Here is an example, use the nodes method to shred the XML into rows, then
> use one of the methods query or value to extract values.
> DECLARE @.x XML;
> SET @.x = ' <ContainerMatrixes>
> <ContainerMatrix>
> <ContRange>RNG20</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG30</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG40</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> </ContainerMatrixes>';
> SELECT T.ContRange.query('.')
> FROM @.x.nodes('ContainerMatrixes/ContainerMatrix/ContRange') AS
> T(ContRange);
> Result is
> <ContRange>RNG20</ContRange>
> <ContRange>RNG30</ContRange>
> <ContRange>RNG40</ContRange>
Thanks for this, it is very helpfull. Studying the BOL I found the way to
use this with a table as well.
For the moment it leaves me with (another) question:
How can I tranform the XML result I get with this towards the value?
TIA,
Erik
|||Found, thanks anyway.
">> Result is
> Thanks for this, it is very helpfull. Studying the BOL I found the way to
> use this with a table as well.
> For the moment it leaves me with (another) question:
> How can I tranform the XML result I get with this towards the value?
> TIA,
> Erik
|||The query below would look like:
SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType/text())[1]',
'varchar(40)') as MType
FROM ERINOT
Best regards
Michael
"E!k Visser" <burod004@.planet.nl> wrote in message
news:5dqj01F33sav3U1@.mid.individual.net...
> Michael,
> Thanks for your contribution, but I do not understand what would be the
> difference.
> What would the query look like in you scenario?
> Perhaps good to know I might be limited by the fact I have to use ADO to
> access the database.
> Erik
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
> news:uexsXRpsHHA.412@.TK2MSFTNGP04.phx.gbl...
>
|||Thanks!
Had to like twice but now I see the difference.
regards,
Erik
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
news:%23IejCQEtHHA.3400@.TK2MSFTNGP03.phx.gbl...
> The query below would look like:
> SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType/text())[1]',
> 'varchar(40)') as MType
> FROM ERINOT
> Best regards
> Michael
> "E!k Visser" <burod004@.planet.nl> wrote in message
> news:5dqj01F33sav3U1@.mid.individual.net...
>

How to query XML

This is the content of one of the rows of the Message column.
<ERINOT VersionMajor="1" VersionMinor="1"
xmlns:mstns="http://tempuri.org/Dataset1.xsd">
<MessageId>
<SenderId>900013581</SenderId>
<ReceiverId>900013574</ReceiverId>
<GenerationDateTime>2005-09-15T05:54:01</GenerationDateTime>
<MessageType>PAS</MessageType>
<MessageNo>22412022</MessageNo>
<MessageFunction>9</MessageFunction>
</MessageId>
</ERINOT>
How can I query let's say the MessageType?
I tried this:
SET ARITHABORT ON
SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType)[0]',
'varchar(40)') as MType
FROM ERINOT
But this does not work
Any suggestion is higly appreciated,
ErikE!k Visser wrote:
> This is the content of one of the rows of the Message column.
> <ERINOT VersionMajor="1" VersionMinor="1"
> xmlns:mstns="http://tempuri.org/Dataset1.xsd">
> <MessageId>
> <SenderId>900013581</SenderId>
> <ReceiverId>900013574</ReceiverId>
> <GenerationDateTime>2005-09-15T05:54:01</GenerationDateTime>
> <MessageType>PAS</MessageType>
> <MessageNo>22412022</MessageNo>
> <MessageFunction>9</MessageFunction>
> </MessageId>
> </ERINOT>
> How can I query let's say the MessageType?
> I tried this:
> SET ARITHABORT ON
> SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType)[0]',
> 'varchar(40)') as MType
> FROM ERINOT
@.MessageType selects an attribute while you have a MessageType element.
Furthermore with XPath/XQuery the first node has index 1 not 0 so use
(/ERINOT/MessageId/MessageType)[1]
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/|||Or if your XML is not constrained by a schema, the following is more
efficient by directly accessing the text node:
(/ERINOT/MessageId/MessageType/text())[1]
Best regards
Michael
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
> E!k Visser wrote:
> @.MessageType selects an attribute while you have a MessageType element.
> Furthermore with XPath/XQuery the first node has index 1 not 0 so use
> (/ERINOT/MessageId/MessageType)[1]
>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/|||Michael,
Thanks for your contribution, but I do not understand what would be the
difference.
What would the query look like in you scenario?
Perhaps good to know I might be limited by the fact I have to use ADO to
access the database.
Erik
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
news:uexsXRpsHHA.412@.TK2MSFTNGP04.phx.gbl...
> Or if your XML is not constrained by a schema, the following is more
> efficient by directly accessing the text node:
> (/ERINOT/MessageId/MessageType/text())[1]
> Best regards
> Michael
> "Martin Honnen" <mahotrash@.yahoo.de> wrote in message
> news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
>|||Martin,
"Martin Honnen" <mahotrash@.yahoo.de> schreef in bericht
news:ObjdJ2osHHA.2164@.TK2MSFTNGP02.phx.gbl...
> E!k Visser wrote:
> @.MessageType selects an attribute while you have a MessageType element.
> Furthermore with XPath/XQuery the first node has index 1 not 0 so use
> (/ERINOT/MessageId/MessageType)[1]
Thank you very much! This works like a charm.
But no I have another question, how can I list all nodes?
This could be the XML:
<ContainerMatrixes>
<ContainerMatrix>
<ContRange>RNG20</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG30</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG40</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
</ContainerMatrixes>
And now I Like to query the ContRange and have three rows as result. It
should be as generic as possible, as in this case a ship usually carries
more than three containers...
Any suggestions?
Erik|||E!k Visser wrote:

> But no I have another question, how can I list all nodes?
> This could be the XML:
> <ContainerMatrixes>
> <ContainerMatrix>
> <ContRange>RNG20</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG30</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG40</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> </ContainerMatrixes>
> And now I Like to query the ContRange and have three rows as result.
Here is an example, use the nodes method to shred the XML into rows,
then use one of the methods query or value to extract values.
DECLARE @.x XML;
SET @.x = ' <ContainerMatrixes>
<ContainerMatrix>
<ContRange>RNG20</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG30</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
<ContainerMatrix>
<ContRange>RNG40</ContRange>
<Number>0</Number>
<ContStatus>6</ContStatus>
</ContainerMatrix>
</ContainerMatrixes>';
SELECT T.ContRange.query('.')
FROM @.x.nodes('ContainerMatrixes/ContainerMatrix/ContRange') AS
T(ContRange);
Result is
<ContRange>RNG20</ContRange>
<ContRange>RNG30</ContRange>
<ContRange>RNG40</ContRange>
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/|||Martin,

> Here is an example, use the nodes method to shred the XML into rows, then
> use one of the methods query or value to extract values.
> DECLARE @.x XML;
> SET @.x = ' <ContainerMatrixes>
> <ContainerMatrix>
> <ContRange>RNG20</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG30</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> <ContainerMatrix>
> <ContRange>RNG40</ContRange>
> <Number>0</Number>
> <ContStatus>6</ContStatus>
> </ContainerMatrix>
> </ContainerMatrixes>';
> SELECT T.ContRange.query('.')
> FROM @.x.nodes('ContainerMatrixes/ContainerMatrix/ContRange') AS
> T(ContRange);
> Result is
> <ContRange>RNG20</ContRange>
> <ContRange>RNG30</ContRange>
> <ContRange>RNG40</ContRange>
Thanks for this, it is very helpfull. Studying the BOL I found the way to
use this with a table as well.
For the moment it leaves me with (another) question:
How can I tranform the XML result I get with this towards the value?
TIA,
Erik|||Found, thanks anyway.
">> Result is
> Thanks for this, it is very helpfull. Studying the BOL I found the way to
> use this with a table as well.
> For the moment it leaves me with (another) question:
> How can I tranform the XML result I get with this towards the value?
> TIA,
> Erik|||The query below would look like:
SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType/text())[1]',
'varchar(40)') as MType
FROM ERINOT
Best regards
Michael
"E!k Visser" <burod004@.planet.nl> wrote in message
news:5dqj01F33sav3U1@.mid.individual.net...
> Michael,
> Thanks for your contribution, but I do not understand what would be the
> difference.
> What would the query look like in you scenario?
> Perhaps good to know I might be limited by the fact I have to use ADO to
> access the database.
> Erik
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
> news:uexsXRpsHHA.412@.TK2MSFTNGP04.phx.gbl...
>|||Thanks!
Had to like twice but now I see the difference.
regards,
Erik
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> schreef in bericht
news:%23IejCQEtHHA.3400@.TK2MSFTNGP03.phx.gbl...
> The query below would look like:
> SELECT ID, Message.value('(/ERINOT/MessageId/@.MessageType/text())[1]',
> 'varchar(40)') as MType
> FROM ERINOT
> Best regards
> Michael
> "E!k Visser" <burod004@.planet.nl> wrote in message
> news:5dqj01F33sav3U1@.mid.individual.net...
>