Get Current date in SQLBase

608 Views Asked by At

I have an SQLBase and I am trying to get the current date of the system to be equal to the date of a column (create_date).

The MySQL Code will be:

Select * From Date D
Where D.Create_date=CURDATE();

Can someone suggest me a way to take the current date in a SQLBase?

The date format should only contain the date(yyyy-MM-dd) and not the timestamp.

2

There are 2 best solutions below

2
On BEST ANSWER

To get the current date, and not time, you should be able to use @DATEVALUE(@NOW).

2
On

This should get you the results you want:

DECLARE @Temp TABLE (
Col1 NVARCHAR(1)
,Date  date 
)

INSERT INTO @Temp
VALUES 
('a','2017-12-08')
,('b','2017-12-08')


SELECT *
FROM @Temp
WHERE Date = CONVERT(date, getdate())