Home > Ask the SQL Server Experts > Andrew Novick - Development Questions & Answers > How to display the XML result of 'Select For XML Explicit'
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

How to display the XML result of 'Select For XML Explicit'

Andrew Novick EXPERT RESPONSE FROM: Andrew Novick

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database administration
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 09 May 2005
I'm using the For XML Explicit statement in a stored procedure. I would like to see the full result set, but only get a partial result set in the Query Analyzer result window. Is there an easy way to display the XML result or save it to a file so I can verify whether the resulting XML is well formed for the eventual user of this output?

>
EXPERT RESPONSE
The output of Select For XML Explicit can be voluminous. SQL Query analyzer doesn't do a great job of presenting the output of For XML queries. For the best results use the menu command Tools -> Options. On the Results tab change the "Maximum characters per column" to 8192. Then use the menu command Query -> Result in Text (Ctrl+T). These options give you the best XML output from Query Analyzer.

Even better than Query Analyzer's output is a utility that I wrote to allow experimentation with For XML queries as Appendix C of the book SQL Server 2000 XML Distilled. The code is in the book's download. The original version of the utility is in Visual Basic 6. I've also written a C# version of the utility, which is available on my Web site.


Do you have comments on this Ask the Expert Q&A? Let us know.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Andrew Novick - Development
Nullable fields in a table
Connecting Visual Basic to SQL Server
Stored procedures in Crystal Reports
Storing an image file in SQL Server
Storing large amounts of data as ntext data type
Stored procedures looking at different databases
Code trigger that captures login and system date
Stored procedures and remote procedure calls
Using newid in SQL Server to insert records in parent-child tables
How to use results from one stored procedure in another

XML in SQL Server
Manage traces in SQL Server 2005 Analysis Services with XMLA commands
Create a computed column in SQL Server using XML data
Create DDL table in SQL Server 2005 to audit DDL trigger activity
Retrieve XML data values with XQuery in SQL Server 2005
XML data type in SQL Server 2005 vs. VARCHAR (MAX)
SQL Server Blog Watch
T-SQL commands vs. XML AUTO in SQL Server
Basic Transact-SQL programming constructs: 15 tips, 15 minutes
Database object qualifiers
Character string data types

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Commerce XML  (SearchSQLServer.com)
DSTP  (SearchSQLServer.com)
XQuery  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts