troubleshooting Question

SQL for XML format header and groups

Avatar of COHFL
COHFLFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2008SQL
9 Comments1 Solution220 ViewsLast Modified:
Hi there,
I'm creating a store procedure that returns simple data pertaining accounts.
What I need to is to format the xml output the following way:

    <Name>                        </Name>
    <Address1>123 Man street      </Address1>

here is the store procedure:
alter procedure usp_Summation360Consumption
SELECT top 100 [AccountNum]
  FROM Consumption360
--  where AccountNum = '000112182'
for xml path ('AccountNum'), root('Account'), type

How can I modify the procedure to get the output I need?
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros