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 |
|
ALBean
Starting Member
12 Posts |
Posted - 2004-05-28 : 11:33:57
|
| How do you tell if the datepart of getdate() equals a field in a table?(basically, I want to know if a date in the table equals today)Example:Select @mydate= mydate from mytable where x=1if (@mydate=getdate()) <does not work |
|
|
drymchaser
Aged Yak Warrior
552 Posts |
Posted - 2004-05-28 : 11:48:54
|
| where datediff(dd, mydate, getdate()) = 0 |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-05-28 : 12:06:36
|
| if you have an index on mydate, you should consider ...mydate = dateadd(dd,datediff(dd,0,getdate()),0)Jay White{0} |
 |
|
|
vganesh76
Yak Posting Veteran
64 Posts |
Posted - 2004-06-01 : 04:27:34
|
| Try using convert of the same dateformat.if (convert(char,@mydate,101) = convert(char,getdate(),101) )Enjoy working |
 |
|
|
|
|
|