I did not design the source table. This is what i have been provided with as a source.Here is some sample data. I don't think there is any way to do this without capturing all of those little "breaks" such as weekends, holidays, etc as there is no way for me to tell if the the break is due to time off or due to not being in that department at that time.PKCREATE TABLE #Agents ( EmployeeNumber [varchar](8) NOT NULL, Location [varchar](10) NULL, ClockDate [datetime] NOT NULL, CONSTRAINT [PK_Agents] PRIMARY KEY CLUSTERED ( [EmployeeNumber] ASC, [ClockDate] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]) ON [PRIMARY]INSERT INTO #Agents (EmployeeNumber ,Location ,ClockDate)SELECT N'111111' AS [EmployeeNumber], N'NE' AS [Location], N'2014-02-25 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'111111' AS [EmployeeNumber], N'NE' AS [Location], N'2014-02-26 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'111111' AS [EmployeeNumber], N'NE' AS [Location], N'2014-02-27 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'111111' AS [EmployeeNumber], N'NE' AS [Location], N'2014-02-28 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-01 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-02 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-03 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-06 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-07 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-08 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-09 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-10 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-13 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-14 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-15 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-16 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-17 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-20 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-21 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-22 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-23 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-24 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-27 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-28 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-29 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-30 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-17 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-18 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-19 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-20 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-21 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-24 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-25 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-26 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-27 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'222222' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-28 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-01 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-02 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-03 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-06 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-07 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-08 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-09 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-10 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-13 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-14 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-15 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-16 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-17 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-18 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-20 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-21 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-22 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-23 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-24 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-27 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-28 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-29 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-30 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-01-31 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-03 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-04 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-05 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-06 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-07 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-08 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-10 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-11 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-12 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-13 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-14 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-17 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-18 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-19 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-20 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-21 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-24 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-25 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-26 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-27 00:00:00.000' AS [ClockDate] UNION ALLSELECT N'333333' AS [EmployeeNumber], N'JC' AS [Location], N'2014-02-28 00:00:00.000' AS [ClockDate]