Split Year ,Month ,Day from DATETIME
Posted Date: May 09, 2013
Category: SQL Query
Today we will see the How to Split Year,Month ,day from DateTime Column in SQL
Here is query
You can achieve this task in two ways.
Let's see the Query:
Split Year,Month and Day from DateTime Column in SQL Server
1 ) Select DATEPART(YEAR,ColName) as [Year],DATEPART(Month,ColName) as
[Month],DATEPART(Day,ColName) as date fromtbl_Name where ColName!=''
2) Select YEAR(ColName) as [Year],Month(ColName) as [Month],Day(ColName) as date from tbl_Name where ColName !=''
You must Sign In To post reply