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 |
|
cjjubb
Starting Member
5 Posts |
Posted - 2008-06-25 : 06:50:19
|
| Hi allIs there an alternate method to check if a value IS NOT NULL using an equals signe.g.WHERE value = NOT NULL (I know this doesn't work!)I know this may seem like a strange question but I the reason I have for needing to do it this way is a long story.Any help would be appreacited |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-25 : 06:51:27
|
| WHERE ISNULL(value,somedefaultvalue) <> somedefaultvalue |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-25 : 10:07:44
|
| WHERE value IS NOT NULL is the correct approachOtherwise index maynot be used if defined on that columnMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-25 : 10:16:24
|
If you change the default ANSI setting, you can write Col1 = NULL or Col1 <> NULL. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-25 : 10:24:38
|
quote: Originally posted by Peso If you change the default ANSI setting, you can write Col1 = NULL or Col1 <> NULL. E 12°55'05.25"N 56°04'39.16"
I wouldnt prefer doing that MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-25 : 10:25:37
|
If VALUE is an identity, you can also useWHERE Value >= 0to get all records NOT NULL. (and where value indeed is greater than or equal to zero) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|