Skip to main content

Constructing XML with T-SQL

  • Chapter
  • First Online:
  • 1313 Accesses

Abstract

T-SQL allows you to convert relational results sets into XML, by using the FOR XML clause in your SELECT statement. There are four modes that can be used with the FOR XML clause; FOR XML RAW, FOR XML AUTO, FOR XML PATH, and FOR XML EXPLICIT. This chapter will demonstrate how the FOR XML clause works in RAW mode, AUTO mode, PATH mode, and EXPLICIT mode. As the chapter progresses, we will move from simple to more complex examples.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Peter A. Carter

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Carter, P.A. (2018). Constructing XML with T-SQL. In: SQL Server Advanced Data Types. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3901-8_3

Download citation

Publish with us

Policies and ethics