Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I save XML result set in a file using query analyzer

Status
Not open for further replies.

essa2000

Programmer
Dec 6, 2000
299
0
0
CA
Dears ;

I am trying to use Select * from authors FOR XML AUTO to generate a XML result set now I want to same this result set in one XML file. How can I do that ! Then I'll populate data in my combo or grid.

Thanks.
Essa

Muhammad Essa Mughal
Software Engineer
iLogic Inc.
 
Hi,

You could use the sp_makewebtask system stored procedure.

sp_makewebtask @outputfile = 'c:\temp\authors.xml',
@query='select * from leaders for xml auto',
@templatefile = 'c:\temp\template.tpl'

The template file, to quote from BOL, &quot;contains information on the formatting characteristics of HTML documents and contains the tag <%insert_data_here%>, which indicates the position to which the query results will be added in an HTML table. templatefile is nvarchar(255).&quot;

Template file formats are reviewed within the &quot;sp_makewebtask&quot; further in BOL.

This is one method to export a file directly from Query Analyzer. Of course, you could also use a DTS export.



Best Regards,
Joseph Sack, Author of &quot;SQL Server 2000 Fast Answers for DBAs and Developers&quot;.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top