Hey, everyone.
I've got a script here to put my table into a flat file format. My problem is I need to add a header record and a trailer record. Here's a condensed version of my script:
select
+LEFT(FNAME + SPACE(35),35)
+LEFT(MNAME + SPACE(35),35)
+LEFT(LNAME + SPACE(35),35)
+LEFT(DOB + SPACE(8),8)
+INSTCODE
from
(select
FIRSTNAME AS FNAME,
MIDDLENAME AS MNAME,
LASTNAME AS LNAME,
DOB AS DOB,
INSTCODE='002'
from Manual.dbo.Met_Need GE
) sub
order by 1
That gives me a flat-file format of the records in my table. What I'm needing is to add a row at the beginning and a row at the end.
The header row needs to say:
000 GE STUBCAR SUBMITTAL20150731S 00100300
And the trailing row would be similar, but slightly different.
How can I make this work?