|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 9:15 AM
Points: 56,
Visits: 487
|
|
Stan Kulp-439977 (3/15/2012) My bet is that during the course of a year they lose some through mergers, bankruptcies, etc. and have to replace them. It may take a while to find suitable replacements.
I played with that data quite a bit, and I have no reason to believe that the 499 count is wrong.
I agree with that. I just wanted to confirm that someone else was also getting the 499 result set. Thanks for the follow-up and very nice article by the way. I don't usually walk through a lot of the steps in these articles but I followed this one all the way through (which is why I was concerned about the 499 results).
Again, thanks for the follow-up.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, March 16, 2012 2:59 PM
Points: 3,
Visits: 20
|
|
| I'll look for the article..
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 5:54 PM
Points: 525,
Visits: 617
|
|
I think this is one of the best XML primers I've seen. Thank you for such a great article!
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 5:04 PM
Points: 54,
Visits: 915
|
|
It took me a while before I could read the article past where we generate XML with attributes and then transform it using a style sheet.
Maybe I'm missing something, but wouldn't it have been easier to use
SELECT DISTINCT * FROM [dbo].[sp500hst] AS StockData WHERE [Date] = '20090821' ORDER BY [Ticker] FOR XML PATH('StockData'),ROOT('StockMarketData') instead of
SELECT DISTINCT * FROM [dbo].[sp500hst] AS StockData WHERE [Date] = '20090821' ORDER BY [Ticker] FOR XML AUTO,ROOT('StockMarketData') followed by a transform using external processes, which, while interesting, doesn't really add much to the discussion about XML in SQL?
All my XML work uses elements not attributes (not my choice, if that matters to anyone), which may explain why this jumped out at me.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 79,
Visits: 601
|
|
I'm sure your way is more efficient, but I was not really focused on the most efficient way to do things when writing this tutorial.
I was interested in demonstrating how to do things in as illustrative and understandable a manner as possible.
I broke it into stages just to illustrate it better, and to prepare for the next article in which I automate the transforms in SSIS.
For me, learning how to do something new is the hard part. Once I understand it, I can figure out how to improve it on my own.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 5:04 PM
Points: 54,
Visits: 915
|
|
Stan Kulp-439977 (3/18/2012) ...I was interested in demonstrating how to do things in as illustrative and understandable a manner as possible.
I broke it into stages just to illustrate it better...
That's exactly why I found it a bit distracting to have a whole section called 'Transform the XML document's attributes into elements' in the middle of an otherwise interesting article; While the transform stuff is interesting in its own right; it's a *bit* off-topic and didn't really help explain 'XML Shredding', which was the core of your article.
I'm looking forward to the next installment... I have some XML transforming stuff I do at a particular customer using Task Manager, I'm interested to see if there'll be any merit in using SSIS instead :)
/Ryan
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 2:31 PM
Points: 1,
Visits: 57
|
|
This article was a great help.
My relational mindset is stubbornly resisting the hierarchical nature of xml and I was having a rough time with even the simplest operations. This article helped me shred a fairly complex xml document that I've been having issues with. My only problem now is that it only seems to be bring in the first instance of a node sequence (ie - if a productID can have multiple itemIDs, my shred only brings in the first ItemID). I suspect this is where the "cross apply" operator comes into play and I'm sure I'll figure it out with some practice.
I'll never be an xml guru, but with the information in this article I no longer consider it an achilles heel. Thanks!
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, December 31, 2012 7:13 PM
Points: 5,
Visits: 6
|
|
** Update** I went through the example as presented and even though it worked it generated error messages (SQL 2012). I changed the script to what I thought it should be and the errors went away. Thanks for taking the time to write the article. I understand the material better than I did yesterday after reading about this topic in one of my books.  ** End Update **
Did you make a mistake in the openxml example?  I ask this because you have the following:
EXEC sp_xml_prepareDocument @hdoc OUTPUT, @Doc
So now I have to access the xml data using @hdoc right? But you do it through @idoc in the following statement.
FROM Openxml (@iDoc,'//StockMarketData/StockData ')
You refer the reader to a Microsoft example which is:
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
OPENXML (@idoc, '/ROOT/Customer',1)
So it would seem that your openxml statement should be:
FROM Openxml (@hdoc, '//StockMarketData/StockData' @iDoc)
Am I correct or am I missing something because I do not understand how you can access the xml data using @idoc which you initialize to a value of 1? Struggling a little with this.
|
|
|
|