• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

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
0
AFIF JABADO
Asked:
AFIF JABADO
  • 2
1 Solution
 
Yagya ShreeCommented:
Please use below query

Select getdate+2
Select enddate-2
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
select * from subscriptions
where datediff(d, getdate(), subscription_date) > 2
0
 
AFIF JABADOAuthor Commented:
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
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
select * from subscriptions
where datediff(d, getdate(), expiry_date) = 2
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now