October 27, 2016 at 8:24 am
Dear All,
I would like to get query with page break which after each group(preffered_name) results end, my sample code given below which gives without page break ..
SELECT preffered_name ,ci.person_num, ci.event_name, CAST(DATEADD(hour,1,dbo.UtcToLocal(ci.creation_date)) AS DATE) AS event_date,
CAST(dbo.UtcToLocal(ci.creation_date) AS date) AS in_date, CAST(dbo.UtcToLocal(ci.creation_date) AS time) AS in_time,
co.event_name, CAST(dbo.UtcToLocal(co.creation_date) AS date) AS out_date, CAST(dbo.UtcToLocal(co.creation_date) AS time) AS out_time,
DATEDIFF(minute, ci.creation_date, co.creation_date) AS mintues
FROM TEST ci
OUTER APPLY (SELECT TOP 1 creation_date, event_name FROM TEST t WHERE t.person_num = ci.person_num AND t.creation_date > ci.creation_date ORDER BY t.creation_date ) co
WHERE ci.event_name = 'CLOCK_IN'
AND (co.event_name IS NULL OR co.event_name = 'CLOCK_IN') AND ci.creation_date > GETDATE()-55 order by preffered_name">.
can you help.
October 27, 2016 at 8:29 am
philand3 (10/27/2016)
Dear All,I would like to get query with page break which after each group(preffered_name) results end, my sample code given below which gives without page break ..
SELECT preffered_name ,ci.person_num, ci.event_name, CAST(DATEADD(hour,1,dbo.UtcToLocal(ci.creation_date)) AS DATE) AS event_date,
CAST(dbo.UtcToLocal(ci.creation_date) AS date) AS in_date, CAST(dbo.UtcToLocal(ci.creation_date) AS time) AS in_time,
co.event_name, CAST(dbo.UtcToLocal(co.creation_date) AS date) AS out_date, CAST(dbo.UtcToLocal(co.creation_date) AS time) AS out_time,
DATEDIFF(minute, ci.creation_date, co.creation_date) AS mintues
FROM TEST ci
OUTER APPLY (SELECT TOP 1 creation_date, event_name FROM TEST t WHERE t.person_num = ci.person_num AND t.creation_date > ci.creation_date ORDER BY t.creation_date ) co
WHERE ci.event_name = 'CLOCK_IN'
AND (co.event_name IS NULL OR co.event_name = 'CLOCK_IN') AND ci.creation_date > GETDATE()-55 order by preffered_name">.
can you help.
Inserting page breaks is the job of whatever tool is used to present the data ... this stuff is not generally done in T-SQL.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply