|
|
Question : Quick Help with MSSQL Select comparing dates
|
|
I have a table named "users" with these fields: username password expirationdate hostnames
In my stored procedure I need to verify that the current date is not past the expiration date. If it is, then it should return "expired" What chunk of code could I use? I'm not sure how to compare dates.
|
Answer : Quick Help with MSSQL Select comparing dates
|
|
IF EXISTS( SELECT null from Users where username = @username and expiration < getdate() ) BEGIN SET@responsestring = 'Expired' RETURN END
|
|
|
|