SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reading from XML does not work


Reading from XML does not work

Author
Message
LutzM
LutzM
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10643 Visits: 13559
kavitus (4/30/2009)
Any good resources of starting with XQuery


I found the following article very helpful:
http://www.simple-talk.com/sql/t-sql-programming/xml-jumpstart-workbench/

@Flo:
The "quote-trick" works on my FireFox-Version, too... w00t



Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Florian Reischl
Florian Reischl
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3681 Visits: 3934
kavitus (4/30/2009)
Any good resources of starting with XQuery


There are some good example in BOL.

Here a little sample for your XML. Do not copy the rendered code! It is damaged by the render engine of this forum... Use the "Quote" button for this post and copy the source from there.


DECLARE @strXML NVARCHAR(MAX)

SELECT @strXML = N'










'

Declare @xmlDat xml

SELECT @xmlDat = @strXML

SELECT
T.C.value('../@id', 'int') DeptId,
T.C.value('@Name', 'varchar(30)') Name,
T.C.value('@Salary', 'int') Salary
FROM @xmlDat.nodes('RECORD/DEPTID/Employee') T(C)



Greets
Flo


The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Florian Reischl
Florian Reischl
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3681 Visits: 3934
lmu92 (4/30/2009)
@Flo:
The "quote-trick" works on my FireFox-Version, too... w00t


Just kidding ;-). The quote-trick works on every browser. The problem is not the browser but the java-script client-side render engine...

Sorry
Flo


The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
RBarryYoung
RBarryYoung
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15332 Visits: 9518
To make your XML show up, you need to qoute it with [ code="xml"]...[/code] tags, instead of '...'. Like this:

kavitus (4/30/2009)






Click the QUOTE button on my post to see how I did this.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
kavitus
kavitus
Grasshopper
Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)

Group: General Forum Members
Points: 16 Visits: 13
Thanks guys. I guess the problem was with the XML not being valid.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search