Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2007, 06:48 PM
Authorized User
 
Join Date: Mar 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to miamikk
Default Sql query output to XML or HTML file

I am a newbie to SQL and I would like to know how can I save the SQL SP query output to an XML or directly to an HTML file ? I need to know how it can be done programatically as I need to generate about 5K-8K reports changing 3 input variables in the SP.

The Stored Procedure and output can be viewed in the image below
http://www.fiu.edu/~atmakurk/kk/results.jpg

The input variables that change are @District, @Month and @RepType.

I would appreciate if anyone can guide me or provide me with link to an article or example on how its done.

Thanks
KK

 
Old June 5th, 2007, 01:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

KK,

Which version of SQL server are you using?

If it is Sql server 2000...
For XML output, you need to consider using
Code:
FOR XML AUTO
at the end of SELECT statement.

For HTML output, you may consider using sp_makewebtask and sp_runwebtask


_________________________
- Vijay G
Strive for Perfection
 
Old June 5th, 2007, 07:25 AM
Authorized User
 
Join Date: Mar 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to miamikk
Default

I am using SQL server 2005.

 
Old June 5th, 2007, 04:14 PM
Authorized User
 
Join Date: Mar 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to miamikk
Default

FOR XML AUTO generates an xml file but do you know or direct me to syntax on how to save the file to a folder ?


Quote:
quote:Originally posted by happygv
 KK,

Which version of SQL server are you using?

If it is Sql server 2000...
For XML output, you need to consider using
Code:
FOR XML AUTO
at the end of SELECT statement.

For HTML output, you may consider using sp_makewebtask and sp_runwebtask


_________________________
- Vijay G
Strive for Perfection
 
Old June 6th, 2007, 03:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You may use BCP utility for storing that into a file under a folder.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Query output to XML using BCP HELP!! miamikk SQL Language 3 May 15th, 2009 08:22 AM
SQL XML Explicit (Output file required) Neal SQL Server 2005 0 August 4th, 2008 03:04 AM
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
how to save html output of xslt to file wtalbin XSLT 2 August 15th, 2003 09:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.