Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2007, 06:48 PM
Authorized User
 
Join Date: Mar 2005
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old June 5th, 2007, 01:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
  #3 (permalink)  
Old June 5th, 2007, 07:25 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to miamikk
Default

I am using SQL server 2005.

Reply With Quote
  #4 (permalink)  
Old June 5th, 2007, 04:14 PM
Authorized User
 
Join Date: Mar 2005
Location: , , .
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
Reply With Quote
  #5 (permalink)  
Old June 6th, 2007, 03:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:23 AM.


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