Click here to monitor SSC
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
Deepak Sharma-2311
Deepak Sharma-2311
Right there with Babe
Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)

Group: General Forum Members
Points: 752 Visits: 455
This question is quite wrong. The SET key word can not be used by = (EqualTo operator). The correct syntax is:
SET ANSI_NULLS OFF
this is wrong:
SET ANSI_NULLS= OFF

Deepak Kumar Sharma
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
SSC Veteran
SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)

Group: General Forum Members
Points: 284 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
SSC Veteran
SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)SSC Veteran (284 reputation)

Group: General Forum Members
Points: 284 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 (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10709 Visits: 12009
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
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2417 Visits: 2763
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.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: 3142 Visits: 434
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