Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Really easy date question - GETDATE()

Status
Not open for further replies.

jasonsalas

IS-IT--Management
Jun 20, 2001
480
GU
I'm running into a problem with a certain T-SQL statement...

InsertDate BETWEEN GETDATE() AND GETDATE()-30

Does GETDATE()-30 mean 30 days ago? Or 30 seconds? Or 30 minutes? Or 30 hours?

Thanks!
 
Also, you need to change that to a valid range:

Code:
InsertDate BETWEEN GETDATE() - 30 AND GETDATE()

Your query would never return any records.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top