Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

DATEADD issue grouping by week

$
0
0
We have bee using something like the following to get the Monday for the specified date.However, we came across a scenario where this is not workingDECLARE @dt AS datetimeSET @dt = '2/19/2006'SELECT DATEADD( ww, DATEDIFF( ww, 0, @dt),0)It had seemed to be working as expected, but we recently came across a problem where The above is returning 2/20, not 2/13

Viewing all articles
Browse latest Browse all 3145