I am trying to part a datetime value and build it together removing minutes, seconds and so on. I want the values to be hourly.
Usually this works on a SQL Server 2012 machine:
DATETIME2FROMPARTS( DATEPART(year, datum), DATEPART(month, datum), DATEPART(day, datum), DATEPART(hour, datum), 0, 0, 0, 0) as dtHour
But unfortunately in SQL Server 2008 it does not! Which function do I need, to fulfill the same job?
I also looked up this reference: Date&Time functions but this were all only SQL Server 2012 compliant.