I have a SQL .mdf database and date-time is combined but I want split them from ‘ ‘ space
I have a SQL .mdf database and date-time is like
| Date-Time |
|---|
| 2021-01-20 12:30:51.000 |
| 2021-01-12 12:23:46.000 |
I want to create 2 new columns and split Date-Time from ‘ ‘ space to this 2 new columns
| Date-Time | Date | Time |
|---|---|---|
| 2021-01-20 12:30:51.000 | 2021-01-20 | 12:30:51.000 |
| 2021-01-12 12:23:46.000 | 2021-01-12 | 12:23:46.000 |
how can I do this from SQL Server Management Studio
>Solution :
Select FORMAT([date-time], 'yyyy-MM-dd') AS[Date],
FORMAT([date-time], 'HH:mm:ss:m0') AS [Time]
FROM YourTable