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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2006-03-26 : 09:34:43
|
| There is a field [submit date] which data type is smalldatetime. How to make where clause "...where [submit date] = today" work?[submit date] data is "3/26/2006 10:23:01"... |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-03-26 : 09:39:20
|
| somthing like this Select * From <TableName> Where [Submit Date] = GetDate()If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them. |
 |
|
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2006-03-26 : 09:47:21
|
| I did this way but got nothing because minute is different. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-26 : 09:51:00
|
[code]Select * From <TableName> Where [Submit Date] = dateadd(day, datediff(day, 0, GetDate()), 0)[/code] KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-26 : 10:00:42
|
since your column also has time portion do a between:[code]Select * From <TableName> Where [Submit Date] between dateadd(day, datediff(day, 0, GetDate()), 0) and dateadd(day, datediff(day, 0, GetDate()+1), 0)[code]Go with the flow & have fun! Else fight the flow |
 |
|
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2006-03-26 : 10:15:26
|
| I did Khtan's way before but no luck. Spirit way works, thank of all. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-27 : 01:18:48
|
| I think spirit's should beSelect * From <TableName> Where [Submit Date] >= dateadd(day, datediff(day, 0, GetDate()), 0) and [Submit Date] < dateadd(day, datediff(day, 0, GetDate()+1), 0)Otherwise Chances are there that data of next day of getdate() can be includedMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|