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 «««1234»»

BIT Conversions Expand / Collapse
Author
Message
Posted Tuesday, August 14, 2012 8:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Saturday, September 13, 2014 8:51 AM
Points: 6,600, Visits: 8,900
Hugo Kornelis (8/14/2012)
WayneS (8/14/2012)
One of the things that I'm trying to learn is to write better QotD questions. It looks like most that have responded here about missing it have acknowledged not reading the question carefully. So, how could this question have been written better?

(The only thing that I can think of is to have bolded the "as a true / 1 value".)


Hi Wayne,

I see nothing wrong with this question. As long as you take the time to read the entire question, I fail to see how one could misunderstand it.
Maybe people who misread the question were only flying over the text and making assumptions on what the question is?


That is exactly what I was aiming for. Thanks Hugo


Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #1344737
Posted Tuesday, August 14, 2012 8:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:24 PM
Points: 5,613, Visits: 25,181
One of the things that I'm trying to learn is to write better QotD questions. It looks like most that have responded here about missing it have acknowledged not reading the question carefully. So, how could this question have been written better?

(The only thing that I can think of is to have bolded the "as a true / 1 value".)

Wayne


Might I suggest that it would have been clearer for myself, and maybe for others, if the wording was:

"How many of these values will be inserted as a 1 into the BitVal column ?"


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 #1344738
Posted Tuesday, August 14, 2012 8:40 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 4:37 AM
Points: 8,823, Visits: 9,382
Hugo Kornelis (8/14/2012)
WayneS (8/14/2012)
One of the things that I'm trying to learn is to write better QotD questions. It looks like most that have responded here about missing it have acknowledged not reading the question carefully. So, how could this question have been written better?

(The only thing that I can think of is to have bolded the "as a true / 1 value".)


Hi Wayne,

I see nothing wrong with this question. As long as you take the time to read the entire question, I fail to see how one could misunderstand it.
Maybe people who misread the question were only flying over the text and making assumptions on what the question is?


+1

Definitely nothing wrong, no trick, no ambiguity, and absolutely straightforward wording.


Tom
Post #1344764
Posted Tuesday, August 14, 2012 8:55 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Yesterday @ 4:37 PM
Points: 705, Visits: 6,006
I have to agree that this was a great question and don't see how it could be interpreted any other way. I think the "trap" may have been people knowing how the bit data type behaves in SQL Server and reading only what they wanted to read in the question. I'll admit, I saw it was a bit data type then read "which of the following values will be inserted" and almost went directly to answering without finishing the question since I was familiar with bit conversions. Fortunately I stopped myself, read the ENTIRE question, then answered.
Post #1344777
Posted Tuesday, August 14, 2012 9:06 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, May 15, 2014 8:37 PM
Points: 589, Visits: 2,437
Easy question as I had to face it in my programming some time ago!
Thanks!
Post #1344785
Posted Tuesday, August 14, 2012 9:06 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 4:02 PM
Points: 3,798, Visits: 1,165
L' Eomot Inversé (8/14/2012)
Hugo Kornelis (8/14/2012)
WayneS (8/14/2012)
One of the things that I'm trying to learn is to write better QotD questions. It looks like most that have responded here about missing it have acknowledged not reading the question carefully. So, how could this question have been written better?

(The only thing that I can think of is to have bolded the "as a true / 1 value".)


Hi Wayne,

I see nothing wrong with this question. As long as you take the time to read the entire question, I fail to see how one could misunderstand it.
Maybe people who misread the question were only flying over the text and making assumptions on what the question is?


+1

Definitely nothing wrong, no trick, no ambiguity, and absolutely straightforward wording.

I also agree there is nothing wrong with it. We must read and analyze the question.

Great question, Wayne!!


"El" Jerry.

"A watt of Ottawa" - Gerardo Galvan

To better understand your help request, please follow these best practices.
Post #1344786
Posted Tuesday, August 14, 2012 10:06 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 4:51 PM
Points: 21,733, Visits: 15,424
Good job Wayne - good question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1344837
Posted Tuesday, August 14, 2012 10:49 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 11:09 AM
Points: 869, Visits: 2,399
Thomas Abraham (8/14/2012)
Excellent question. I particularly like questions, like this one, that highlight areas where the behavior is not as one might think, or is different than you might find in other languages. These are the gotchas that you have to know. Thanks!


Agreed. SQL syntax is essentially old C syntax - 0 is false, nonzero is true.
Post #1344883
Posted Tuesday, August 14, 2012 12:28 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 1:35 AM
Points: 261, Visits: 300
in correct answer -1,1 is correct

but how 25 is correct

means to say... in bit datatype how we can store 25 (2 digit) value

??????
Post #1344956
Posted Tuesday, August 14, 2012 12:40 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 4:46 PM
Points: 5,998, Visits: 8,261
buntyteg (8/14/2012)
means to say... in bit datatype how we can store 25 (2 digit) value

No. Any value other than 0 is converted to 1. So 1 is stored as given, and both -1 and 25 are converted to 1. (Which, by some tools, is interpreted and shown as true).



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1344963
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse