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 |
|
freephoneid
Yak Posting Veteran
52 Posts |
Posted - 2010-03-17 : 19:20:19
|
| Hi, I observed a weird thing...I don't have much exposure to SQL server. When I write the below query, it returns proper records with null valuescol is of type DATETIME SELECT * FROM table WHERE col = nullBut when I run below query, it does not return any records. Why is that so?SELECT * FROM table WHERE col = NULL AND DATEADD(DAY, 10, col) >= DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0) I'm trying to get results for all records whose col is null and col+10days >= Current date.Please note that vendors & products are views.Appreciate your help!Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-03-18 : 06:17:23
|
And a column value cannot be BOTH null and have a value at the same time,so I suggest you change the AND to OR instead. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|