year from date sql code example Example: sql get year from datetime field SELECT YEAR(DateTimeField) FROM MyTable