SQL LIKE statement for date?

liunx

Guest
Can we write LIKE statement for date?
I tried in Query Analyzer and it didnt give me any results..
how to do actually?
SELECT * FROM Announcement WHERE AncDate LIKE '%03-08-2006%'Hi, if your field on your sql table is define as Datetime, then you won't be able to use the Like clause. What exactly are you trying to accomplish? Maybe using something like >= or <= would do the tricks?I wanna check if the record is still new (for example not more than 3 days) then the label "updates" will get displayed. I've used another way to check it. Check the latest record, and compare with today's date, if different < 3, then label will be displayed.have you consider the use of stored procedure?

that way you can just need to execute that function, and sql will return everything you want that is "still new"
 
Back
Top