Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
srussell
Starting Member
9 Posts |
Posted - 2008-09-08 : 10:57:08
|
| I have a database table that stores records according to date. I neet to pull out the row only if the date portion of the datetime field mathes the current date.This is what I currently have and it's not working:select * from table1 where id ='1' and date = CONVERT (datetime, GETDATE()) |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2008-09-08 : 11:28:10
|
| [code]SELECT *FROM Table1WHERE [id]= 1 AND [date] >= DATEADD(d, 0, DATEDIFF(d, 0, GETDATE())) AND [date] < DATEADD(d, 1, DATEDIFF(d, 0, GETDATE()))[/code] |
 |
|
|
srussell
Starting Member
9 Posts |
Posted - 2008-09-08 : 11:53:12
|
| Thanks it worked great! |
 |
|
|
|
|
|