Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL where to_date()

Hi,

I have a problem on a data loading.

I want to filter the data during loading step with a date filter, for example:

SQL Select *

from db

where DateDB > TO_DATE('01012013','DDMMYYYY');

The script does not show any error but it does not extract any record (but record with those dates are present in db).

Database is SQL Server db.

Anyone can help me?

Many thanks in advance.

Davide

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

TO_DATE is an oracle function, not a SQL SERVER one.

Try something like

Let vCutDate = date(Today(),'MM/dd/yyyy');

LOAD *;

SQL SELECT *

FROM db

WHERE DateDB >= convert(datetime,'$(vCutDate)',101);

Or check the SQL Server convert function online

View solution in original post

2 Replies
danielrozental
Master II
Master II

TO_DATE is an oracle function, not a SQL SERVER one.

Try something like

Let vCutDate = date(Today(),'MM/dd/yyyy');

LOAD *;

SQL SELECT *

FROM db

WHERE DateDB >= convert(datetime,'$(vCutDate)',101);

Or check the SQL Server convert function online

Not applicable
Author

Ok,

thanks.

Convert function works correctly. I had a problem in another filter so no data was extracted.

Thanks very much,

Davide