declare @part varchar(10) set @part = 'YEAR' select case @part when 'YEAR' then datepart(yy,SomeDateTimeColumn) when 'MONTH' then datepart(mm,SomeDateTimeColumn) else datepart(dd,SomeDateTimeColumn) end from SoMetable