tsql check if datediff is 2 days only btween enddate and getdate
i want to use the function datediff to match all record whe have difference btween the enddate end current date is 2
for example each record has a expirydate i want to gets all records where the subscription end after 2 days
Microsoft SQL Server 2005Microsoft SQL Server 2008SQL
Last Comment
Kyle Abrahams
8/22/2022 - Mon
Yagya Shree
Please use below query
Select getdate+2
Select enddate-2
Kyle Abrahams
select * from subscriptions
where datediff(d, getdate(), subscription_date) > 2
AFIF JABBADO
ASKER
i want only get if is equal to 2 !! for automatic renew the subscription
if the expiration end after 2 days i will send to the user a notification not > 2
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Select getdate+2
Select enddate-2