Solved

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

Posted on 2012-12-21
4
686 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
Comment Utility
Please use below query

Select getdate+2
Select enddate-2
0
 
LVL 39

Expert Comment

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

Author Comment

by:afifosh
Comment Utility
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 39

Accepted Solution

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now