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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 simple dataType query

Author  Topic 

DesiGal
Starting Member

31 Posts

Posted - 2009-10-16 : 10:43:49
In my SQL table I have a field called Category. It can have only two possible values(Animal or Plant).

So my question is .....
Is it a good idea to declare the datatype for Category as nvarchar(10) or a bit field(true or false) or have a separate category table and include its id

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-16 : 11:14:09
There are many ways possible.
Howe about data type char(1) with value 'A' or 'P'?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

DesiGal
Starting Member

31 Posts

Posted - 2009-10-16 : 11:40:48
on my Grid I have a Combo box with a drop down(Item:Plant/Animal)..if that helps
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-16 : 11:46:43
If you decide to have a separate table category then you're open for the future.
Maybe there comes a time you have to handle more than these two values.
(Animal,Plant,Human,Alien,Yak)

The category table would also be fine as input for the allowed values in the drop down.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -