Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by bitbucket
»
NULLIF 1
53 posts, Page 1 of 6
1
2
3
4
5
»
»»
NULLIF 1
Rate Topic
Display Mode
Topic Options
Author
Message
bitbucket-25253
bitbucket-25253
Posted Monday, June 25, 2012 9:38 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 8:55 AM
Points: 5,099,
Visits: 20,190
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
Koen Verbeeck
Koen Verbeeck
Posted Monday, June 25, 2012 11:20 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 6:54 AM
Points: 9,364,
Visits: 6,462
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
rhythmk
rhythmk
Posted Tuesday, June 26, 2012 12:30 AM
Old Hand
Group: General Forum Members
Last Login: Saturday, November 10, 2012 9:30 AM
Points: 388,
Visits: 603
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
rhythmk
rhythmk
Posted Tuesday, June 26, 2012 12:32 AM
Old Hand
Group: General Forum Members
Last Login: Saturday, November 10, 2012 9:30 AM
Points: 388,
Visits: 603
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
imarran
imarran
Posted Tuesday, June 26, 2012 12:34 AM
Old Hand
Group: General Forum Members
Last Login: Tuesday, April 09, 2013 4:15 AM
Points: 309,
Visits: 86
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
palotaiarpad
palotaiarpad
Posted Tuesday, June 26, 2012 12:46 AM
SSC Eights!
Group: General Forum Members
Last Login: Yesterday @ 2:20 AM
Points: 841,
Visits: 317
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
Carlo Romagnano
Carlo Romagnano
Posted Tuesday, June 26, 2012 12:59 AM
SSCommitted
Group: General Forum Members
Last Login: Yesterday @ 2:04 AM
Points: 1,968,
Visits: 1,819
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
iBar
iBar
Posted Tuesday, June 26, 2012 1:04 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Thursday, April 18, 2013 11:16 AM
Points: 572,
Visits: 746
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
derek.colley
derek.colley
Posted Tuesday, June 26, 2012 1:32 AM
SSC-Addicted
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:40 AM
Points: 496,
Visits: 583
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
imarran
imarran
Posted Tuesday, June 26, 2012 1:42 AM
Old Hand
Group: General Forum Members
Last Login: Tuesday, April 09, 2013 4:15 AM
Points: 309,
Visits: 86
Is the goal of the question to catch people out or test SQL skill and knowledge?
Post #1321066
« Prev Topic
|
Next Topic »
53 posts, Page 1 of 6
1
2
3
4
5
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.