SQL SERVER 2000 DataType BIT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenniekuah
    New Member
    • Oct 2006
    • 126

    SQL SERVER 2000 DataType BIT

    Hi Good Guys,
    I am back and need your help. Please help me.

    SQL SERVER 2000 Table.
    What is the meaning of DataType BIT and also what's the meaning of value 0 and 1.

    Does value 0(zero) Means NO or FALSE ?
    Does value 1 (one) Means YES or TRUE ?

    I feel so helpless about it. Please Help me



    Thank you.
    Cheers,
    Lennie
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    It's litterally a 'bit'... and yes you can translate the values as true and false. http://msdn.microsoft.com/en-us/library/ms177603.aspx

    Comment

    • lenniekuah
      New Member
      • Oct 2006
      • 126

      #3
      Hi yarbrough40,
      Thank you very much for your help.
      I tried creating this SQL String to retrieve our company products supplier Active status and display the details on the DataGridView but it generated this error message

      Incorrect syntax near '='.

      Here is the SQL String that is not working
      Select SupplierID, SupplierName,
      iif (Status = 1, 'Active', 'NotActive') as [Status]
      from TblSupplier


      This :iif (Status = 1, 'Active', 'NotActive') as [Status] generated the error message



      Please help me. Thanks.

      Cheers,
      Lennie

      Comment

      • yarbrough40
        Contributor
        • Jun 2009
        • 320

        #4
        iif is not supported with sqlsqever. That is a VBA function. you need to use a CASE statement

        Comment

        • lenniekuah
          New Member
          • Oct 2006
          • 126

          #5
          Hi yarbrough40,
          Greetings.
          This is Lennie20.

          Regarding your suggestion of using CASE Statement, how the coding looks like. The SQL String that I have tried is based in a VBNET2008 FORM and not in the SQL SERVER 2000 Stored Procedures or Transact SQL.

          Can you please share with me the sample FORM Based SQL String and not SQL SERVER 2000 Stored Procedures or Transact SQL.

          Thank you.

          Cheers,
          Lennie

          Comment

          • yarbrough40
            Contributor
            • Jun 2009
            • 320

            #6
            is your form hitting SQL SERVER to return your data? if so then understand that it is SQL SERVER syntax that you need to use. I don't know what you mean by "FORM Based SQL", I think that you are confused. What have you tried so far? show me and I will assist you.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32661

              #7
              I don't think anyone can help you here with your question as it seems to be about .NET rather than T-SQL. That said, I couldn't just move it as it is, as it makes so little sense anyway and there's too little information available even for a .NET expert to help you with.

              As far as explaining the BIT datatype goes, BIT is a shortened form of BInary digiT. It is a single digit that reflects only two possible states. It can be off or on. These values can be expressed in many ways, 0 and 1; FALSE & TRUE; NO & YES; etc.

              You would typically have 8 of these BITs in a BYTE and a multiple of that in a WORD. No addressable data location contains as little data as a single BIT.

              I don't know if that can help you, but at least it gives some background that will hopefully help.
              Last edited by NeoPa; Sep 13 '10, 01:27 PM.

              Comment

              • ck9663
                Recognized Expert Specialist
                • Jun 2007
                • 2878

                #8
                As Neo mentioned, a BIT can only have two values. It can be used for a lot of ways. You can even use it as Gender identifier (M/F) or a switch (T/F - On/Off). It's a data type that can only have two possible (aside from NULL, of course). However you use it is up to you...

                Happy Coding!!!

                ~~ CK

                Comment

                • lenniekuah
                  New Member
                  • Oct 2006
                  • 126

                  #9
                  Hullo Yarbrough40,

                  This is Lennie20.

                  As per your statement that I am confused, ** Snip **

                  What I mean that it's a FORM SQL string it means that the SQL String is part of the coding behind the FORM and it's not a SQL SERVER Stored Procedures or transactSql.

                  If you are familiar with programming you will understand the SQL string in the coding behind the form


                  Finally I got the SQL String working. I am going to post it here to share with others Newbies whose Table in SQL SERVER with DataType BIT and value of 0 (zero) and 1 (one) and the column header ALLOW NULL do not tick on it to allow NULL. Also set the default value properties to 0 (zero). On the Data Entry FORM, perform textbox validation check for either 0 (zero) or 1 (one)

                  Code:
                  Select SupplierID, SupplierName, 
                  (CASE Status when 1 then 'Active' Else  'NotActive' End) as [Status]
                  From TblSupplier
                  Last edited by NeoPa; Sep 14 '10, 08:52 PM. Reason: Removed unhelpful comment. Please watch your tone in future. This is clearly explained in our rules.

                  Comment

                  • yarbrough40
                    Contributor
                    • Jun 2009
                    • 320

                    #10
                    yes - this is the CASE statement I told you to use. And it worked, right? Please be careful with your "tone" when you post in this forum. this is a group that exists to help each other and the comments in your last post were not particularly helpful nor conducive to what we are trying to accomplish here. That being said - I am pleased that you found your solution.

                    Comment

                    • lenniekuah
                      New Member
                      • Oct 2006
                      • 126

                      #11
                      Hi yarbrough40

                      I do thank you for your suggestion but

                      This is your statement made earlier:
                      is your form hitting SQL SERVER to return your data? if so then understand that it is SQL SERVER syntax that you need to use. I don't know what you mean by "FORM Based SQL", I think that you are confused. What have you tried so far? show me and I will assist you.

                      You mentioned that I am confused but I am not confused and I asked you whether you are familar with writing SQL statement behind the FORM. So we are pointing fingers at each other.

                      Another of your statement:
                      yes - this is the CASE statement I told you to use. And it worked, right? Please be careful with your "tone" when you post in this forum. this is a group that exists to help each other and the comments in your last post were not particularly helpful nor conducive to what we are trying to accomplish here. That being said - I am pleased that you found your solution.


                      You mentioned be careful to your tone, ** Snip **, because you accused me of being confused because I was not. I am using SQL String in the coding being the FORM. While you thoughts are in SQL SERVER.

                      It's not my intention to offend anyone but I felt very hurt by you and your tone which makes me sound so stupid which affected my job because my IT Development Manager read it too.
                      Last edited by NeoPa; Sep 14 '10, 09:14 PM. Reason: Accusatory tone again. Last chance.

                      Comment

                      • yarbrough40
                        Contributor
                        • Jun 2009
                        • 320

                        #12
                        ahhh, ok I get it. You need to understand that when someone says that they think you are confused, This is not an attack. whether or not that is an accurate statement is up for debate but this is acceptable verbiage to use in a posted response. No one should think that this is a derogetory comment. Perhaps there is a cultural misunderstandin g here. In the end - you shouldn't jump to conclusions that someone is attacking you, especially in a help-centered message forum such as this. We're all here to play together : )

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32661

                          #13
                          Originally posted by Lennie
                          Lennie:
                          It's not my intention to offend anyone but I felt very hurt by you and your tone which makes me sound so stupid which affected my job because my IT Development Manager read it too.
                          Lennie, you should understand that you are skating on thin ice here. I have told you to watch your tone and, as a member of this site, you are expected to follow advice from a moderator.

                          I will step in if I feel that anyone has been abusive. You may draw my attention to it if you feel I may have overlooked something (The Report button). In this case it was not overlooked. It was neither abusive nor offensive, and you are out of line responding to it this way.

                          If you feel that you have been made out in a bad light for your manager to see, then look to your own actions. How will your manager see your choosing to respond with an aggressive or accusatory tone, immediately after being told not to by a moderator? Does that make you look clever do you think.

                          I must warn you now, that further breaches of our rules (which most emphatically include doing something you have been told not to do by a moderator) may result in your account being suspended for a period, and a complete ban if you still choose not to follow our rules. The rules are here for everybody's benefit, and they will be applied where necessary. I hope you understand.
                          Last edited by NeoPa; Sep 14 '10, 09:15 PM.

                          Comment

                          • lenniekuah
                            New Member
                            • Oct 2006
                            • 126

                            #14
                            NeoPa Quotation
                            Lennie, you should understand that you are skating on thin ice here. I have told you to watch your tone and, as a member of this site, you are expected to follow advice from a moderator.


                            You should refer your statement not only to me but to those who made the wrong statment as well including yourself.


                            Another NeoPa Quotation
                            I must warn you now, that further breaches of our rules (which most emphatically include doing something you have been told not to do by a moderator) may result in your account being suspended for a period, and a complete ban if you still choose not to follow our rules. The rules are here for everybody's benefit, and they will be applied where necessary. I hope you understand.


                            I hope you understand you what said as well. You are not fair and started blaming me and not those of Abusive and false accusing me. You are not facing the truth sincerely. MY IT Manager just read this and said to me.
                            "This guy are not facing the Fact and is a very poor MOderator hopefully the Owner of this FORUM will removed him. Afterall this is not your first time using this FORUM and you have been sharing with NEWBIES working coding that you obtained from here. You are nice Lennie.

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32661

                              #15
                              Lennie,

                              I'm sorry you still seem to misunderstand the situation. As Yarbrough says, I expect it is a language confusion or even a cultural one perhaps. No-one here insulted you (Had they done so I would certainly have stepped in). You simply mis-interpreted what was said.

                              That said, I don't have a problem with your being upset with me. As a moderator I have to expect that sometimes. As long as your posts are not breaking the rules I will not apply any discipline, and I don't feel your last is abusive, though it's not the sort of tone we would hope to see from anyone coming here to ask for our help.

                              I do recommend you relax a bit before submitting your posts. We are here to help. Generally I would not expect too many people to want to spend their spare time helping you, if your response is immediately (without due consideration) to accuse them of being rude, and remember all your posts are public.

                              Comment

                              Working...