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


Generate HTML output for given SQL Query


Generate HTML output for given SQL Query

Author
Message
dav0id
dav0id
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 343
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?
Mike Dougherty-384281
Mike Dougherty-384281
SSC Eights!
SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)

Group: General Forum Members
Points: 816 Visits: 944
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. Smile

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.
Paul Paiva
Paul Paiva
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1019 Visits: 265
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/
rjoseph
rjoseph
SSC-Enthusiastic
SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)

Group: General Forum Members
Points: 123 Visits: 145
So what is the final code for this tool. I would love to use this but I cannot see how. Where do you obtain the output after running this script via SSMS or do you obtain it from a job. Please help, I trying to get similar outputs for hard disk, logs, space reporting.

Thanks and regards,
Iwas Bornready
Iwas Bornready
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21694 Visits: 885
Thanks for the script.
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