Both the functions DATENAME and DATEPART are used to extract the informations from the date. However there is a difference between the two in terms of return datatype. DATENAME function always return the varchar datatype whereas DATEPART functions return Integer datatype Consider the following example which is used to extract year value from current date
DATENAME returns varchar datype where DATEPART returns Integer datatype
SELECT DATENAME(year,GETDATE())
SELECT DATEPART(year,GETDATE())
Both the above returns the value 2011 Now to check the actual datatype returned, run the following
SELECT DATENAME(year,GETDATE())+'a'
SELECT DATEPART(year,GETDATE())+'a'
The first code returns the value 2011a
-------------------------------
2011a
whereas the second code returns the error
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'a' to data type int.
So it is clear that the return type of DATENAME is varchar and return type of DATEPART is Integer