Solved

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

Posted on 2012-12-21
4
694 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Yagya Shree
ID: 38714422
Please use below query

Select getdate+2
Select enddate-2
0
 
LVL 40

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 40

Accepted Solution

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

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
query output (script) from a stored procedure 4 49
SP result not being displayed 5 65
Merge join vs exist 3 37
What is GIS method of Geometry data type? 6 28
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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