bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server YEAR() Function

Concept visual

SQL Server YEAR() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the year part of a date:

SELECT YEAR('2017/08/25') AS Year;

Definition and Usage

The YEAR() function returns the year part for a specified date.

Syntax

Year(

date )

Parameter Values

Parameter

Description date

Required. The date or datetime to extract the year from

Technical Details

Return type:

int

Works in:

SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

More Examples

Example

Return the year part of a date: SELECT YEAR('1998/05/25 09:08') AS Year;

Previous

❮ SQL Server Functions

Next

Previous

SQL Server SYSDATETIME() Function

Next

SQL Server CAST() Function