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
Loading
Kirtan PatelPosted Oct 16, 2009, 10:47 AM
as you told it just having two values and you don't need to add new values to category in future then dont make new
table for catagory . if you think that need will be arise in future to add new catagories then better to make new table
with seperate id .
make it like nvarchar(50) or varchar(50) .
using bit field is also good idea but you need to write decode query every time when you want to show result
so better to use varchar or nvarchar
please check "do you like this answer" if you have found my answer helpful to you :)
Desi GalPosted Oct 16, 2009, 10:49 AM