Tricks to format XML properly for output from a SQL query

A few things I've learned in the past few days on

SELECT {something}  FOR XML AUTO, ELEMENTS

  1. Use subquery to denormalize data so that they can be grouped under the same parent element.
  2. Do not use synonym to get to your linked server.  If you want any elements to be named properly, use full linked server syntax and alias the table/subquery.

I'll add more as I learn them.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Thursday, December 03, 2009 1:44 PM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Kevin Shyr

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski