Reputation: 91
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.
Upvotes: 3
Views: 635
Reputation: 5707
To get the current date, and not time, you should be able to use @DATEVALUE(@NOW)
.
Upvotes: 3
Reputation: 1
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())
Upvotes: -2