I want to convert below Oracle query into SQL server environment-
select to_date(substr(to_char(col1, 'YYYYMMDD HH24MISS),1,8), 'YYYYMMDD') from tab;
From the above query i want to convert it into first time in Date format and then second time Time format . It means two times i want this query while above one in Date format .
This is not even how I would do this in Oracle. This is converting the date/time value to a date, with no time component. In SQL Server:
select cast(col1 as date)
from tab;
In Oracle:
select trunc(col1)
from tab;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.