SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question of the Day for 01 Mar 2007


Question of the Day for 01 Mar 2007

Author
Message
peratchiselvi.m
peratchiselvi.m
SSC-Addicted
SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)

Group: General Forum Members
Points: 452 Visits: 7
In the answer for this question, "The expression "MyID = NULL" evaluates to Unknown rather than any true or false condition."
then y it is false... instead of unknown. can anyone pls answer this...
Jasmine D. Adamson
Jasmine D. Adamson
Old Hand
Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)

Group: General Forum Members
Points: 354 Visits: 140
peratchiselvi.m (3/23/2010)
In the answer for this question, "The expression "MyID = NULL" evaluates to Unknown rather than any true or false condition."
then y it is false... instead of unknown. can anyone pls answer this...


It isn't "false" it is "null" - but it will fail in a where clause or case statement because it's "not true"
peratchiselvi.m
peratchiselvi.m
SSC-Addicted
SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)

Group: General Forum Members
Points: 452 Visits: 7
s. ssc went wrong there then.... thank u...
Jasmine D. Adamson
Jasmine D. Adamson
Old Hand
Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)Old Hand (354 reputation)

Group: General Forum Members
Points: 354 Visits: 140
peratchiselvi.m (3/24/2010)
s. ssc went wrong there then.... thank u...


No not really, it's a kind of a trick question... when you use the = operator and compare to null, the result is always unknown rather than true or false. The proper expression is "IS NULL" which will evaluate to true or false rather than unknown. That's what the question was about.
peratchiselvi.m
peratchiselvi.m
SSC-Addicted
SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)SSC-Addicted (452 reputation)

Group: General Forum Members
Points: 452 Visits: 7
ok. ok. got it....thanks.
TomThomson
TomThomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14250 Visits: 12197
I read this question, decided it was a bit weird because where clauses don't evaluate to anything and concluded that it must be asking what truth-value/values the expression in the where clause evaluates to and ansered accordingly (UNKNOWN). The answer given as correct is FALSE. The explanation simply says that the contained expression always evaluates UNKNOWN, and doen't make any suggestion of how FALSE comes from here. I guess the author has invented a new terminology: in this new terminology a filter evaluates to something instead of including or excluding a row, and "evaluates to false" means "excludes the current row". That's not very useful, as the existing terminology makes perfect sense.

Tom

kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3069 Visits: 2766
easy one for NULL :-)

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
GP Van Eron
GP Van Eron
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3272 Visits: 453
I understand what the author was trying to achieve in the question but it is still syntactically incorrect and will generate an error. (SET ANSI_NULLS = ON)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search