Hello Experts,
How do i split datetime column into different columns while doing a Select statement.
Ex:
The column "REC_CRT_TS" has data like "2014-05-08 08:23:09.0000000".The datatype of this column is "DateTime". And i want it in SELECT statement like;
SELECT YEAR(DATETIME) YEAR, MONTH(DATETIME) MONTH, DATENAME(DATETIME) MONTHNAME, DATEPART(DATETIME) WEEKNUM, DAY(DATETIME) DATE, DATEPART(DATETIME) HOUR FROM TABLE_NAME;
The output should look like this;
--YEAR| MONTH | MONTHNAME| WEEKNUM | DATE | HOUR --2014| 5 | May | 25 | 08 |08
Any suggestions please.
Thanks!
Rahman