Compatible syntax for getting date of today in both SQL Server and Oracle

Viewed 741

How can I write the following so that it works for both SQL Server and Oracle (that is, without having to comment or uncomment, depending on the environment):

SELECT col1, col2
FROM table
WHERE -- anytime today
    -- date_requested = TRUNC(SYSDATE) -- Oracle
    date_requested = CONVERT(date, GETDATE()) -- SQL Server

I need to compare date_requested with today's date (without time).

1 Answers
Related