Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need help with bit value tables!

Author  Topic 

DallasTower
Starting Member

1 Post

Posted - 2007-05-30 : 16:31:31
Hello!

I need some pointers as how to set up a database with a lot of bit values. I have a windows form where I want a user to enter an order number, and then answer about 15 yes/no questions using checkboxes. Each checkbox also corresponds to a value, mostly being 0 if the checkbox is unchecked, and > 0 if checked.

Since I´m very new to this, I´m having trouble understanding how to set this up in an efficient manner. I had some idea about only using one table, and having one column for the state of each checkbox. Then I could have a lookup table for each of the columns with the values corresponding to yes/no for each checkbox. I´m pretty sure I could solve the problem this way.

However, I´m also pretty sure that there are ALOT better ways to solve this! So please, what would be the best way to set this up?
Any help is most appreciated!

Regards
Daniel

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-05-30 : 16:44:15
SQL will optimize the storeage of your bits a little. Storing each Yes/No as a bit is just fine. But, If you wanted to do more complex quries using bit masking, then you would need to change things a little. Here is an article that talks about one way to handle bits. Although, this article is not about Yes/No type issues it might get you going: [url]http://sqlblog.com/blogs/denis_gobo/archive/2007/05/29/test.aspx [/url]
Go to Top of Page
   

- Advertisement -