
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok,
thanks.
Convert function works correctly. I had a problem in another filter so no data was extracted.
Thanks very much,
Davide
