We help IT Professionals succeed at work.
Get Started

How do I alter the output where the attributes are elements in this MS SQL statement

197 Views
Last Modified: 2015-09-25
Here is the statement I am using to generate the XML.  However it need to have attributes that are elements/


select id, Rtrim(title)as title1, author, datecreated, Rtrim(body) as body1, image1,
REPLACE(RTRIM(SUBSTRING(Title, 1, 25)), ' ', '-') AS pagename
from ecsuheadlines
FOR XML AUTO

Current output:
<ecsuheadlines id="428" title1="Faculty make headlines" author="Kesha Williams" datecreated="2005-01-03T00:00:00" body1="ECSU announces the following briefs of achievements by its faculty and staff: &lt;p&gt;&#xD;&#xA;&#xD;&#xA; &#xD;&#xA;&#xD;&#xA;Dr. Carolyn R. Mahoney, ECSU Provost and Vice Chancellor for Academic Affairs, was a co-author on the National Research Council Report &quot;On Evaluating Curricular Effectiveness: Judging the Quality of K-12 Mathematics Evaluations,&quot; Washington, DC, at the National Academies Press in May 2004.  &lt;p&gt;&#xD;&#xA;&#xD;&#xA;Dr. Carolyn Mahoney, ECSU Provost and Vice Chancellor of Academic Affairs, was an invited plenary speaker at the Education Trust annual national conference on closing the achievement gap. Her talk, entitled &quot;Access, Retention and Completion: The ECSU Story&quot; was delivered to national educators, community leaders and policy makers in Washington, DC in November


Preferred output
<headlines>
<headline>
                <id>428</id>
                <title1> Faculty make headlines </title1>
                <author> Kesha Williams </author>
                <datecreated>2005-01-03T00:00:00</datecreated>
                <body1>ECSU announces the following briefs of achievements by its faculty and staff: &lt;p&gt;&#xD;&#xA;&#xD;&#xA; &#xD;&#xA;&#xD;&#xA;Dr. Carolyn R. Mahoney, ECSU Provost and Vice Chancellor for Academic Affairs, was a co-author on the National Research Council Report &quot;On Evaluating Curricular Effectiveness: Judging the Quality of K-12 Mathematics Evaluations,&quot; Washington, DC, at the National Academies Press in May 2004.  &lt;p&gt;&#xD;&#xA;&#xD;&#xA;Dr. Carolyn Mahoney, ECSU Provost and Vice Chancellor of Academic Affairs, was an invited plenary speaker at the Education Trust annual national conference on closing the achievement gap. Her talk, entitled &quot;Access, Retention and Completion: The ECSU Story&quot; was delivered to national educators, community leaders and policy makers in Washington, DC in November
Comment
Watch Question
EE Topic Advisor
CERTIFIED EXPERT
Most Valuable Expert 2014
Awarded 2013
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE