July 9, 2014 at 5:59 am
I've been asked to create an SSIS package to export data out as and XML file.
I've got the xml file down but now the customer is wanting a header row added to the first line of the xml file.
I've tried adding it in the Header row for the flat file destination but getting an error that it cannot parse the Header file.
Any suggestions would be appreciated.
Thanks in Advance
Wayne
July 9, 2014 at 11:07 am
What do you mean by a header row? By definition XML doesn't have rows, it has elements and attributes.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 9, 2014 at 12:05 pm
I had created the SSIS package to pull just the student data.
What the vendor was wanting was the XML information <?xml version="1.0" encoding="utf-8"?> added to the first row of the extract.
I finally found the place to add it and how to add it after several searches.
Thanks
July 25, 2014 at 7:07 pm
Please post your solution!
Thanks...
July 26, 2014 at 4:31 am
In the heading area when setting up the destination file I had to add in <?xml version="1.0" encoding="utf-8"?>
That gave me what the vendor was needing in the file.
July 27, 2014 at 1:16 pm
If you can possibly describe how you get the file to output, I would greatly appreciate it.
I have a query where I can get the XML that I need, but When I run the query with 'Results to text' or 'Results to file' selected, the text or file contains a line starting with the characters "XML..." and a second line containing dashes '--------------...'
I just need the XML in a file.
Thanks for any direction that you may provide!
July 28, 2014 at 6:16 am
Here is how I setup my SQL Script to pull the data into an XML File.
SELECT(select s.StudentNumber As DisplayID, s.PersonID AS ExternalAccountID, sc.number AS SchoolID,s.FirstName, s.LastName, s.Gender,
CONVERT(varchar,s.birthdate,101) AS Birthdate, s.Grade AS GradeLevel,
CASE WHEN ts.PhysicalDate IS NOT NULL THEN CONVERT(varchar,ts.physicaldate,101)ELSE '' END As LastPhysicalDate,
MAX(CASE WHEN pe.eligibility ='F' THEN '3'WHEN pe.eligibility = 'R' THEN '2'ELSE '1'END) As EconomicIndicator
FROM student s
JOIN SchoolYear sy ON sy.endYear = s.endYear
LEFT JOIN TempScreening ts ON ts.personid = s.personID
JOIN calendar ca ON ca.calendarID = s.calendarID
JOIN School sc ON sc.schoolID = ca.schoolid
LEFT JOIN POSEligibility pe on pe.personid = s.personid
where studentnumber IS NOT NULL and sy.active = 1 and s.endDate IS NULL or s.endDate >=GETDATE()
AND ca.schoolID NOT IN( 12,13,32,16,34,14,15,25)
GROUP BY s.studentNumber, s.personID, sc.number,s.firstName, s.lastName,s.gender, s.birthdate, s.grade,ts.physicaldate
FOR XML PATH('Student'), root('Students')
)as Data
Hope this helps
July 28, 2014 at 6:18 am
Forgot to mention. I'm running mine in an SSIS package so just created a Flat File destination to send the file.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply