I have a SQL Server .mdf
database and date-time is combined but I want split them from ' ' space.
I have date-time like this:
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 these 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 in SQL Server Management Studio?
Select FORMAT([date-time], 'yyyy-MM-dd') AS[Date],
FORMAT([date-time], 'HH:mm:ss:m0') AS [Time]
FROM YourTable