[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2014-03-14
1
Medium Priority
?
244 Views
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
0
Comment
Question by:forcedexposure
1 Comment
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 2000 total points
ID: 39930511
SELECT ...
FROM dbo.tablename
WHERE
    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)
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

829 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