Home Forums SQL Server 2008 T-SQL (SS2K8) Argument data type datetime is invalid for argument 1 of substring function RE: Argument data type datetime is invalid for argument 1 of substring function

  • Since 'pehPaydate' has a datatype of datetime, you can use the DATENAME function to return the month name - i.e. you won't need the case statement anymore. So the case statement become DateName (Month, pehPaydate).

    e.g. SELECT DateName (Month, getdate()) returns the string "August" (the date today is 22nd August 2013).