Is there a way to pass the DatePart parameter of DateDiff as a variable? So that I can write code that is similar to this?
DECLARE @datePart VARCHAR(2) DECLA
I don't think there are better ways then you describe. Sql Server probably compiles the DATEDIFF query to a set of operations that depend on the datepart parameter. So you'd need a CASE, or dynamic queries.