Avatar of Jack Seaman
Jack SeamanFlag for United States of America

asked on 

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

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
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
Jack Seaman
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jack Seaman
Jack Seaman
Flag of United States of America image

ASKER

I've tried that and it seems to work.  I've set off the file and will see if this is expectable.  Should know by EOB today.
Avatar of Jack Seaman
Jack Seaman
Flag of United States of America image

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for wjseaman's comment #a40946175

for the following reason:

It worked.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

If my solution worked, why is this being closed with zero points?
Avatar of Jack Seaman
Jack Seaman
Flag of United States of America image

ASKER

Where do I award points?
Not that I didn't want too....
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo