Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Other SQL Server Topics / February 2008

Tip: Looking for answers? Try searching our database.

Help setting up stored procedure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ297 - 26 Feb 2008 19:27 GMT
I'm trying to get all records that are 7 days pass duedate
(fieldname)

Select * from Library
where duedate > getdate()

How do I get it to show only records that are 7 days pass getdate?

Thanks!
Plamen Ratchev - 26 Feb 2008 19:50 GMT
Try something like this:

SELECT duedate
FROM Library
WHERE duedate < DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP) - 7, 0)

HTH,

Plamen Ratchev
http://www.SQLStudio.com
JJ297 - 26 Feb 2008 20:04 GMT
> Try something like this:
>
[quoted text clipped - 5 lines]
>
> Plamen Ratchevhttp://www.SQLStudio.com

Pefect...Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.