How to add a Header Row and Trailer Row on SQL Server (1 Viewer)

proballin

Registered User.
Local time
Today, 08:00
Joined
Feb 18, 2008
Messages
105
I have a query that pulls data just like I want in SQL Server 2000. However I need to add a header and trailer row so that it appears as:

HEADER (contains various name information, but also a time stamp)
Detail1
Detail2
Detail3
Detail4
TRAILER (should just show the amount of detail records)

How should this be done in SQL Server 2000 to output to a text or some sort of .csv file? Thanks in advance!
 

HiTechCoach

Well-known member
Local time
Today, 08:00
Joined
Mar 6, 2006
Messages
4,357
I do not think you will be able to do this in a single recordset with query.

I normally write code to loop through the header records and write the header to a file then follow it by the detail records followed by the footer record. Loop until all records have be written to the file.
 

Users who are viewing this thread

Top Bottom