How to retrieve year from date in sql - Sql Server.

 

Introduction

Today i will tell you how to retrieve year from date using sql.

History

In the Previous articles i explained how to retrieve day from date using C#.nethow to retrieve month from date in c#.nethow to retrieve year from date in c#.nethow to retrieve day from date in sql, how to retrieve month from date in sql and many more about Sql.

Today or in future you will have to get year from date using sql.

Step 1.

SELECT Year('2/4/2014') AS [date_year]

Here what we are doing is getting year from current date of server.

Suppose you want to get date from table then use below query.

SELECT Year(date_column) AS [date_year] FROM Table_name

That's It.

Give your Valuable Comments.
comments powered by Disqus
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles