SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date query (pulling system date)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dan1980
Starting Member

United Kingdom
9 Posts

Posted - 11/01/2013 :  08:08:51  Show Profile  Reply with Quote
Hello

Hoping someone can help.

I'm currently using the SQL to find records older than todays date in the SSD_SED field. I'm having to update the date manually each day. Is there a way I can automate this?

AND (SSD_SED < '2013-11-01')order by SSD_SED DESC

Regards

Dan

madhivanan
Premature Yak Congratulator

India
22761 Posts

Posted - 11/01/2013 :  08:14:34  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
AND (SSD_SED < dateadd(day,datediff(day,0,getdate()),0))order by SSD_SED DESC

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17645 Posts

Posted - 11/01/2013 :  08:14:56  Show Profile  Reply with Quote

select getdate()

or

select dateadd(day, datediff(day, 0, getdate()), 0)



KH
Time is always against us

Go to Top of Page

Dan1980
Starting Member

United Kingdom
9 Posts

Posted - 11/01/2013 :  09:23:26  Show Profile  Reply with Quote
Thanks guys. Works great.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000