0

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.

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.