|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:16 AM
Points: 5,
Visits: 224
|
|
I would tend to agree with Mike Dougherty-384281. This approach seems like a bad idea for a number of reasons.
Why not use a "FOR XML" query and transform the XML on a web page?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 9:18 AM
Points: 198,
Visits: 682
|
|
dav0id (10/25/2011) I would tend to agree with Mike Dougherty-384281. This approach seems like a bad idea for a number of reasons.
Why not use a "FOR XML" query and transform the XML on a web page?
I couldn't tell if your question is rhetorical, a suggestion, or an inquiry. :)
I would avoid using FOR XML on the general principle that it's still a large volume of string manipulation even if in the guise of a native feature. Mostly we're still using SQL Server 2000 instances and what I read of its newfangled XML capability made me think it should be avoided. Perhaps '2008 has evolved sufficiently that it's a viable solution.
If your proposed XML transform on the web page is using DOM methods on the XML document, the performance win you might be getting from requesting XML directly from the database (at the cost of exposing the server directly to clients?) you then pay in DOM method performance. A web service in front of the SQL Server minimizes server exposure, gives a web-side cache opportunity, and can probably respond to client-side/browser xmlhttp requests with JSON.
The author's original post is an example of a possible solution. As the opening move in the discussion that follows, I want to thank Raja Mohamed for taking the time to write it up. I felt it was a worthwhile contribution to this community to point out the potential scalability problem. Thanks dav0id for agreeing my concern is valid.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, January 21, 2013 1:19 PM
Points: 727,
Visits: 264
|
|
Raja,
Excellent job, thanks for sharing the code! Worked perfectly for me.
Regarding the last two persons to post comments - you make good points that there are better and more efficient ways, but you completely missed the spirit of the article. That is, there may be times when you don't have that perfect situation. For example, I needed a way to properly format my query for sending in the body of an email. This did the trick.
Paul
- Paul
http://paulpaivasql.blogspot.com/
|
|
|
|