Viewing 8 posts - 16 through 23 (of 23 total)
select cast(CAST(getdate() as DATE) as datetime)
results of running Jeff Moden's script on my 2008R2 with additional cast/cast convertion
(1000000 row(s) affected)
--===== DATEADD/DATEDIFF =============================================
SQL Server Execution Times:
...
December 21, 2011 at 3:24 am
2 ChrisM@home
even more simple 🙂declare @subgroupsize int
set @subgroupsize=3
select dense_rank() over(order by act,grp desc) grp_no,1+(rn-1)/@subgroupsize grp_sub_no
,grp,member,act
from
(select * ,ROW_NUMBER() over(partition by act,grp order by (select 0))...
December 21, 2011 at 2:43 am
2 mic.con87
Sure
expression DATEADD(day, DATEDIFF(day, '19000105', IncidentDate) /7*7, '19000105') calculates latest Friday before or on a given reference date
The rest is clear
dateadd(hh,19,DATEADD(day, DATEDIFF(day, '19000105', IncidentDate) /7*7, '19000105')) ...
December 20, 2011 at 1:05 am
;with
q1 as (select *
,case when exists(select * from #Broker b where b.Broker=td.Broker) then 1 else 0 end StartT
,case when exists(select * from #Portfolio p where p.Portfolio=td.Portfolio) then 1 else 0...
December 19, 2011 at 10:22 pm
declare @Incidents table(IncidentDate datetime)
insert into @Incidents
select '20111216 18:59:00' union all
select '20111216 19:00:00' union all
select '20111218 19:00:00' union all
select '20111218 19:01:00'
SELECT IncidentDate
,case when IncidentDate between dateadd(hh,19,DATEADD(day, DATEDIFF(day, '19000105',...
December 19, 2011 at 1:16 pm
Jeff Moden (12/19/2011)
December 19, 2011 at 7:59 am
December 18, 2011 at 10:25 pm
Viewing 8 posts - 16 through 23 (of 23 total)