﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Wayne Sheffield  / BIT Conversions / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 11:09:49 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>good questions......manik123**********</description><pubDate>Tue, 29 Jan 2013 06:32:55 GMT</pubDate><dc:creator>manik123</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Great question, thanks.</description><pubDate>Wed, 15 Aug 2012 23:21:42 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Thanks for an easy one, Wayne!</description><pubDate>Wed, 15 Aug 2012 12:57:19 GMT</pubDate><dc:creator>Revenant</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Nice question. Made me pause for a moment. Thanks!</description><pubDate>Wed, 15 Aug 2012 07:02:50 GMT</pubDate><dc:creator>KWymore</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]buntyteg (8/14/2012)[/b][hr]in correct answer -1,1 is correct but how 25 is correctmeans to say... in bit datatype how we can store 25 (2 digit) value??????[/quote]If it helps, think of it this way:[code="sql"]DECLARE @BitValue BIT;SET @BitValue = CASE WHEN ValueToConvert = 0 THEN 0 ELSE 1 END;[/code]</description><pubDate>Tue, 14 Aug 2012 13:50:00 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]buntyteg (8/14/2012)[/b][hr]means to say... in bit datatype how we can store 25 (2 digit) value[/quote]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 [i]true[/i]).</description><pubDate>Tue, 14 Aug 2012 12:40:11 GMT</pubDate><dc:creator>Hugo Kornelis</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>in correct answer -1,1 is correct but how 25 is correctmeans to say... in bit datatype how we can store 25 (2 digit) value??????</description><pubDate>Tue, 14 Aug 2012 12:28:05 GMT</pubDate><dc:creator>buntyteg</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]Thomas Abraham (8/14/2012)[/b][hr]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![/quote]Agreed.  SQL syntax is essentially old C syntax - 0 is false, nonzero is true.</description><pubDate>Tue, 14 Aug 2012 10:49:44 GMT</pubDate><dc:creator>Nadrek</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good job Wayne - good question.</description><pubDate>Tue, 14 Aug 2012 10:06:29 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]L' Eomot Inversé (8/14/2012)[/b][hr][quote][b]Hugo Kornelis (8/14/2012)[/b][hr][quote][b]WayneS (8/14/2012)[/b][hr]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".)[/quote]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?[/quote]+1Definitely nothing wrong, no trick, no ambiguity, and absolutely straightforward wording.[/quote]I also agree there is nothing wrong with it. We must read and analyze the question.Great question, Wayne!!</description><pubDate>Tue, 14 Aug 2012 09:06:36 GMT</pubDate><dc:creator>EL Jerry</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Easy question as I had to face it in my programming some time ago!Thanks!</description><pubDate>Tue, 14 Aug 2012 09:06:11 GMT</pubDate><dc:creator>tilew-948340</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>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.</description><pubDate>Tue, 14 Aug 2012 08:55:16 GMT</pubDate><dc:creator>roryp 96873</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]Hugo Kornelis (8/14/2012)[/b][hr][quote][b]WayneS (8/14/2012)[/b][hr]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".)[/quote]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?[/quote]+1Definitely nothing wrong, no trick, no ambiguity, and absolutely straightforward wording.</description><pubDate>Tue, 14 Aug 2012 08:40:45 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote]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[/quote]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 ?"</description><pubDate>Tue, 14 Aug 2012 08:11:25 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]Hugo Kornelis (8/14/2012)[/b][hr][quote][b]WayneS (8/14/2012)[/b][hr]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".)[/quote]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?[/quote]That is exactly what I was aiming for. Thanks Hugo</description><pubDate>Tue, 14 Aug 2012 08:11:03 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]WayneS (8/14/2012)[/b][hr]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".)[/quote]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?</description><pubDate>Tue, 14 Aug 2012 07:48:02 GMT</pubDate><dc:creator>Hugo Kornelis</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Nice question!  </description><pubDate>Tue, 14 Aug 2012 07:43:11 GMT</pubDate><dc:creator>sestell1</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]Dana Medley (8/14/2012)[/b][hr]I almost fell prey to the wording of the question, but after reading it twice I realized my original answers were incorrect. Thank you for the great question.[/quote]Dana,I'm curious about the "I almost fell prey to the wording of the question" - what was there in this question that got you feeling this way? (I'm trying to get better at writing these QotD's).</description><pubDate>Tue, 14 Aug 2012 07:37:29 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]Jan.Sundbye (8/14/2012)[/b][hr]Good one. Once again I fell right into the trap. Must remember to RTFQ / RTFS (Read the **** Question / Statement)[/quote]Jan,I was trying to not have a "trap". What about this question do you consider to have been a trap? (I'm trying to get better at writing these QotD's).</description><pubDate>Tue, 14 Aug 2012 07:35:37 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>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".)</description><pubDate>Tue, 14 Aug 2012 07:34:33 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>[quote][b]davoscollective (8/14/2012)[/b][hr]Ack! I can explain why the 32%.I read the question and thought the trick was about the numbers that weren't 1 or 0 and went ahead and ticked all the boxes knowing they would all be inserted. ... but not all as True.Doh!My fault for not answering it carefully.[/quote]+1 I should know better than to answer before my first cup of coffee...</description><pubDate>Tue, 14 Aug 2012 07:33:11 GMT</pubDate><dc:creator>GeauxCode</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good back to basics question... I'm glad I had my morning coffee first or I would have missed the 1/True bit.  :)</description><pubDate>Tue, 14 Aug 2012 06:49:27 GMT</pubDate><dc:creator>mtassin</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>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!</description><pubDate>Tue, 14 Aug 2012 06:43:40 GMT</pubDate><dc:creator>Thomas Abraham</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>I almost fell prey to the wording of the question, but after reading it twice I realized my original answers were incorrect. Thank you for the great question.</description><pubDate>Tue, 14 Aug 2012 06:41:11 GMT</pubDate><dc:creator>Dana Medley</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>..although I have been wrong,Good question!</description><pubDate>Tue, 14 Aug 2012 05:59:46 GMT</pubDate><dc:creator>JoseACJr</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good question, my bad is I just ignored 1 so I checked only -1 and 25 I missed out 1 :-)</description><pubDate>Tue, 14 Aug 2012 05:47:50 GMT</pubDate><dc:creator>Prassad Dabbada V R</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good question.A lot of careless readers around today - 31% (about 80) so far have picked 0, and I suspect the number of those who picked that for some other reason that having misread the question is very small indeed.</description><pubDate>Tue, 14 Aug 2012 05:47:03 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Excellent question, Wayne.Thank you.</description><pubDate>Tue, 14 Aug 2012 04:59:47 GMT</pubDate><dc:creator>codebyo</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good one. Once again I fell right into the trap. Must remember to RTFQ / RTFS (Read the **** Question / Statement)</description><pubDate>Tue, 14 Aug 2012 04:13:40 GMT</pubDate><dc:creator>SQL Surfer '66</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>I was very careful with this one.  Have been burnt too many times by not reading the question closely.  Great question Wayne!</description><pubDate>Tue, 14 Aug 2012 04:12:21 GMT</pubDate><dc:creator>(Bob Brown)  </dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Doh!Good question, my bad for missing the as True/ 1 part. I knew they would all insert correctly...Must remember to read question after having coffee!Rodders...</description><pubDate>Tue, 14 Aug 2012 02:58:57 GMT</pubDate><dc:creator>rodjkidd</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Good back-to-basics question, thanks Wayne</description><pubDate>Tue, 14 Aug 2012 02:46:40 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Ack! I can explain why the 32%.I read the question and thought the trick was about the numbers that weren't 1 or 0 and went ahead and ticked all the boxes knowing they would all be inserted. ... but not all as True.Doh!My fault for not answering it carefully.</description><pubDate>Tue, 14 Aug 2012 02:06:07 GMT</pubDate><dc:creator>davoscollective</dc:creator></item><item><title>RE: BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Nice question. Surprised at the number selecting '0' as an answer though. 32% presently.</description><pubDate>Tue, 14 Aug 2012 01:23:45 GMT</pubDate><dc:creator>arthurolcot</dc:creator></item><item><title>BIT Conversions</title><link>http://www.sqlservercentral.com/Forums/Topic1344517-1273-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/questions/T-SQL/92419/"&gt;BIT Conversions&lt;/A&gt;[/B]</description><pubDate>Mon, 13 Aug 2012 21:49:21 GMT</pubDate><dc:creator>WayneS</dc:creator></item></channel></rss>