Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

NULLIF 1 Expand / Collapse
Author
Message
Posted Monday, June 25, 2012 9:38 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, November 6, 2014 1:00 PM
Points: 5,333, Visits: 25,277
Comments posted to this topic are about the item NULLIF 1

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1320989
Posted Monday, June 25, 2012 11:20 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 11:36 AM
Points: 13,636, Visits: 11,508
Haven't used NULLIF before, so I learned something.

Small error: the select statement selects 4 columns, the answers have only 3.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1321012
Posted Tuesday, June 26, 2012 12:30 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 3:28 AM
Points: 579, Visits: 914
One more function added in my memory DB

--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1321034
Posted Tuesday, June 26, 2012 12:32 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 3:28 AM
Points: 579, Visits: 914
Koen Verbeeck (6/25/2012)
Haven't used NULLIF before, so I learned something.

Small error: the select statement selects 4 columns, the answers have only 3.


Nice observation Koen


--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1321035
Posted Tuesday, June 26, 2012 12:34 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 25, 2014 12:54 AM
Points: 320, Visits: 104
badly formed answers
you are selecting 4 columns in your question (ID, Y, Test1, Test2) yet your answers and the supposed "correct" one only has 3
Post #1321036
Posted Tuesday, June 26, 2012 12:46 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, December 12, 2014 12:49 AM
Points: 1,391, Visits: 515
imarran (6/26/2012)
badly formed answers
you are selecting 4 columns in your question (ID, Y, Test1, Test2) yet your answers and the supposed "correct" one only has 3
Say, not optimal, but if you read the complete task 'The values are listed as ID, TEST1, TEST2. For example: 1, 3, 0', then it should be clear.
I searched the trick behind the question, but found nothing, so all 4 selected, and won a point. Thx!
Post #1321039
Posted Tuesday, June 26, 2012 12:59 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:53 AM
Points: 2,620, Visits: 2,466
Koen Verbeeck (6/25/2012)
Small error: the select statement selects 4 columns, the answers have only 3.

BIG ERROR: I answered thinking at the first 3 columns, so that Y would return without conversion.
Post #1321045
Posted Tuesday, June 26, 2012 1:04 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, December 11, 2014 8:32 AM
Points: 574, Visits: 817
Yes i Agree,

However in second line of question, following is also mentioned.

"The values are listed as ID, TEST1, TEST2. For example: "

So reading full question and all details can avoid such confusions.

Cheers
Post #1321048
Posted Tuesday, June 26, 2012 1:32 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 22, 2013 9:13 AM
Points: 496, Visits: 601
Caught me out there, I returned 3 of the 4 correct answers. 2,NULL,0 I thought is not valid. Well done.

---

Note to developers:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!

Want to get the best help? Click here http://www.sqlservercentral.com/articles/Best+Practices/61537/ (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
Post #1321063
Posted Tuesday, June 26, 2012 1:42 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 25, 2014 12:54 AM
Points: 320, Visits: 104
Is the goal of the question to catch people out or test SQL skill and knowledge?
Post #1321066
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse