Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Select cellection of bit fields if is true ??

Select cellection of bit fields if is true ??

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kindman_nb
    wrote on last edited by
    #1

    Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...

    jooooo

    M B W P 4 Replies Last reply
    0
    • K kindman_nb

      Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...

      jooooo

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      kindman_nb wrote:

      .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True

      :doh:

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      1 Reply Last reply
      0
      • K kindman_nb

        Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...

        jooooo

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        Can you be more descriptive in your question?


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        1 Reply Last reply
        0
        • K kindman_nb

          Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...

          jooooo

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          You can create a stored procedure and handle this inside the procedure. However, your problem is in modelling. You should break the table to at least two table. Separate table for Forms and separate table for allowed operations. This way you can query what operations are allowed and those that are not allowed, are not listed. Mika

          1 Reply Last reply
          0
          • K kindman_nb

            Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...

            jooooo

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            Not sure what you mean, do you mean something like this?: select fid,max(cast([read] as int)),max(cast([add] as int)),max(cast([del] as int)) from Forms group by fid

            K 1 Reply Last reply
            0
            • P PIEBALDconsult

              Not sure what you mean, do you mean something like this?: select fid,max(cast([read] as int)),max(cast([add] as int)),max(cast([del] as int)) from Forms group by fid

              K Offline
              K Offline
              kindman_nb
              wrote on last edited by
              #6

              Thanks my friend .. what I mean that for eg .. I have users . every user is subscribe in group and every group has it's permission Read and Add and Del of all forms ... user A is subscribe in Group M and N for eg : customer form : Group M Read true - Add True - Del False Group N Read true - Add False - Del False then i want to select the permission of the user a from the table of permestoin .. you can see that the user has Add is true in group M and the same user has Add is false in group N i want to select True if i hase true or false of the same permissoin .. i hope if you see what mean

              jooooo

              P 1 Reply Last reply
              0
              • K kindman_nb

                Thanks my friend .. what I mean that for eg .. I have users . every user is subscribe in group and every group has it's permission Read and Add and Del of all forms ... user A is subscribe in Group M and N for eg : customer form : Group M Read true - Add True - Del False Group N Read true - Add False - Del False then i want to select the permission of the user a from the table of permestoin .. you can see that the user has Add is true in group M and the same user has Add is false in group N i want to select True if i hase true or false of the same permissoin .. i hope if you see what mean

                jooooo

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Ah, OK, well what I posted should help.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups