?
Solved

tsql check if datediff is 2 days only btween enddate and getdate

Posted on 2012-12-21
4
Medium Priority
?
698 Views
Last Modified: 2012-12-21
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
Comment
Question by:afifosh
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Yagya Shree
ID: 38714422
Please use below query

Select getdate+2
Select enddate-2
0
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 38714424
select * from subscriptions
where datediff(d, getdate(), subscription_date) > 2
0
 
LVL 1

Author Comment

by:afifosh
ID: 38714430
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
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 38714444
select * from subscriptions
where datediff(d, getdate(), expiry_date) = 2
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question