|
-
Dec 8th, 2001, 11:41 AM
#1
Thread Starter
Lively Member
DB Field Types
Hi
This question is more to do with database design, something I`ve recently started.
My question is... I have a form used as a front end to a SQL DB. The form controls what is entered into the database. It contains multiple radio buttons with text such as 'Small' 'Medium' 'Large'. At present if 'Small' is selected a value of 'Small' (string) is added to the DB. Would it be better to have each of these text values mapped to a value of type INT? ie. 'Small' = 1, 'Medium' = 2, 'Large' = 3 etc. So when 'Medium' is selected a value of '2 would be added rather than "Medium'. Would this result in faster query returns?
Would like to know which would be the better way to go.
Any help or advice would be appreciated.
Thanks
Kelly
-
Dec 8th, 2001, 11:54 AM
#2
I would use the Numbers, because you could use a control array for your option buttons.
So lets say
optBtn(1) is your small option
optBtn(2) is your medium option
optBtn(3) is your large option
If you store the number in the DB so when you load the data back you can just use optbtn(rs.fields("field1").value = true.
Hope this helps,
-
Dec 8th, 2001, 02:06 PM
#3
Fanatic Member
I would use strings. A database should be designed so that it is independent of any front end application. A string is more readable and useful (suppose another app needs a list of the string values, what're you going to do, map it back from numbers to strings?).
VB 6.0, Access, Sql server, Asp
-
Dec 8th, 2001, 09:26 PM
#4
Well ...
Wherever possible, in such cases, use numbers.
It will ease the job of writing queries, for one, as you don't have to type out long words, and no bother about the case.
.
-
Dec 8th, 2001, 10:17 PM
#5
Thread Starter
Lively Member
Thanks for your replies.
I was thinking the best way would be to have a reference table within the database which links the values to the string of text.
So, if someone selects 'Large', the program will go to the reference table and find 'Large' then select the int value linked with 'Large' and insert it into the record. This way it would not be limited to the front end??
Secondly, I don`t really want the user to be able to understand the raw data in the database??
I guess I`m just trying to weigh up adv and disadv. of each method.
Thanks again
Kelly
-
Dec 9th, 2001, 01:34 PM
#6
Well ...
That is a good suggestion, but only when you require a large number of such options, and also want the user to customize it to suit his needs.
.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|