MS SQL query finds all dates that are greater than next Tuesday

Posted on 2014-03-14
Medium Priority
Last Modified: 2014-03-16
Hi There,

How do i go about creating a SQL query for my table that returns all records for a date that is greater than next Tuesday's date?

thanks! Kristin
Question by:forcedexposure
1 Comment
LVL 70

Accepted Solution

Scott Pletcher earned 2000 total points
ID: 39930511
FROM dbo.tablename
    date_or_datetime_column >= DATEADD(DAY, DATEDIFF(DAY, 1, GETDATE()) / 7 * 7 + 7, 1) AND
    date_or_datetime_column < DATEADD(DAY, DATEDIFF(DAY, 1, GETDATE()) / 7 * 7 + 7 + 1, 1)

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

607 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