Search notes:

SQL Server functions: year(), month() and day()

The SQL Server functions year(), month() and day() return a a date's year, month or day as an integer.
select
   year  (getdate()),
   month (getdate()),
   day   (getdate())
Unfortunately, there is no hour(), minute() or second() function (Error message for example: «'hour' is not a recognized built-in function name.»).
These values can be queried with datename:
select
   dateName(hh, getDate())   hour,
   dateName(mi, getDate())   minute,
   dateName(ss, getDate())   second

See also

Extracting year, month, day, hour, minute and second as integer from a VBA date value.

Index