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 |
|
jonreeves
Starting Member
3 Posts |
Posted - 2005-09-13 : 08:41:04
|
| HiLooking to run a query that selects items from the current day. I have been using the GETDATE statement but due to this pulling through the time as well it doesnt not match the date in the table. Does anybody know how to just pull the date with out the time or any other way round this?ThanksJon |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2005-09-13 : 08:45:40
|
| select convert(varchar,getdate(),101)He is a fool for five minutes who asks , but who does not ask remains a fool for life!http://www.sqldude.4t.comhttp://www.sqljunkies.com/weblog/sqldude |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-13 : 08:46:29
|
| Select Dateadd(d,datediff(d,0,getdate()),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-13 : 08:47:24
|
harshal, I think Convert function is not neccessary MadhivananFailing to plan is Planning to fail |
 |
|
|
jonreeves
Starting Member
3 Posts |
Posted - 2005-09-13 : 08:51:06
|
| Thanks guysCould you possibly help me a little further, i now need to incororate that in to the query in running.So far i have something simple likeDelete <Table Name>Where <Filed Containing Date> = Getdate()????? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-13 : 08:55:13
|
| Do you want to delete the records that are added today?If so try thisBut before running this take back up of that table and if the deletion is wrong then restore itDelete <Table Name>Where DateDiff(d,DateCol,GetDate())=0MadhivananFailing to plan is Planning to fail |
 |
|
|
jonreeves
Starting Member
3 Posts |
Posted - 2005-09-13 : 09:11:09
|
| thanks that works perfectly |
 |
|
|
|
|
|