473,804 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing Text Values Instead of ID's for the Sake of Users

Hi all. I'm creating a FE/BE database that will be used by about 6 users. As
usual, I have several fields, such as "OrganizationTy peID" that will get
values (via combo boxes in forms) from separate lookup tables. I know the
'correct' way to do this, using a long integer as the field type. In this
case, however, I am considering doing it "incorrectl y", by actually storing
the text in my field rather than an ID, still using a lookup table, but
joining on the text and using cascading updates. I'm considering this
because the users are going to want to create their own queries and reports,
and it might be less confusing for them if they don't have to join to the
lookup tables all the time. It seems to me that the main disadvantages will
be the extra storage requirements (1 byte per character vs. 4 bytes per long
int) and the speed of data transfer. I think I can deal with integrity
issues with the cascading updates, but I haven't tried this before.

I'm asking to see if any experienced developers have done this same thing
with ok results, or if anyone has ideas against it that I haven't thought
of.
(I'm a pretty experienced Access developer)

thanks
-John
Mar 17 '06
14 1827
"John Welch" <john(remove)we lch@cal(remove) central.com> wrote
I'm thinking of having the field actually store
text and having the text be the foreign key to
the lookup table which has text as it's
primary key.


Sorry for my misunderstandin g.

You can certainly use a text Field as the Primary Key of the related table,
and if you are careful in constructing it, it can be an abbreviation or
mnemonic that is obvious to the mere human user.

The only drawback to using a text Field for a Primary Key is that
Access/Jet/yourServer won't automatically generate it for you. You may need
more than a single Text field to uniquely identify a record, and, if so, you
might still have to create a "surrogate key" (that's the only purpose for an
Autonumber key, AFAICT).

Note to those who take strong positions on "natural" vs. "surrogate" keys.
Please argue that elsewhere, without expecting me to join in the argument.
Thanks.

Larry Linson
Microsoft Access MVP
Mar 18 '06 #11

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Nope. I just update
eg Before Income Tax Season I run:
UPDATE Transactions SET Account = 'Charity Donation' WHERE Account =
'Beer'


Lyle, you have a hilarious sense of humor. If I am ever in your environs,
I'd like to make a "charity donation" on your behalf at the dispensary of
beverages of your choice.
Mar 18 '06 #12
"John Welch" <john(remove)we lch@cal(remove) central.com> wrote in
news:dv******** *@enews2.newsgu y.com:
Thanks Larry. I can't tell if we're talking about the same thing,
though. I'm _not_ thinking of using "lookup fields" in the sense
of using Access' confusing built in thing where the field stores a
number but displays text. I'm thinking of having the field
actually store text and having the text be the foreign key to the
lookup table which has text as it's primary key.

For example:
tblOrganization s:
OrgID: autonum
OrgName: text
OrgType (fk): text (foundation, household, corporation, etc.)

tblOrgTypes:
OrgType (pk): text (foundation, household, corporation, etc.)

join with cascading updates


I don't see any problem with using real text for these kinds of
codes.

Note that it's really no different from using a table to store the
values for a validation rule, rather than being a relationship that
increases normalization. In this case, there is no benefit in
non-repetition from having the relationship because the entirety of
the related information is repeated. However, this is because it's a
single field that defines the uniqueness of the foreign key record.

This would also be the case of using multi-column natural keys. A
lookup table might have 3 columns, all of which were part of your
PK, and when stored as a foreign key, all three would be repeated.
This is a flaw in the argument for natural keys, in my opinion
(among many others), but for a single-column key, I see no real
problem.

I've done what you're contemplating many times and it works just
fine.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Mar 18 '06 #13
"Larry Linson" <bo*****@localh ost.not> wrote in
news:p%ZSf.4205 $TK2.48@trnddc0 7:

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Nope. I just update
eg Before Income Tax Season I run:
UPDATE Transactions SET Account = 'Charity Donation' WHERE Account =
'Beer'


Lyle, you have a hilarious sense of humor. If I am ever in your
environs, I'd like to make a "charity donation" on your behalf at the
dispensary of beverages of your choice.


Your money won't be any good up here, Larry. (I hope this isn't a uniquely
Canadian expression and that you know what it means.)

--
Lyle Fairfield
Mar 18 '06 #14
Thanks to everyone for the thoughtful and helpful comments. (and for the
humor too, Lyle: I got a great laugh out of that one.)
I'm going to get rid of the autonumbers in my one-field lookup tables.
-John
Mar 19 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3067
by: Mark | last post by:
I have a website with an increasing amount of articles and news reports and so I am thinking of moving away from storing each article as a seperate page to having a single page and storing articles in a databasewhich are retrieved using a GET parameter. I see the advantage to me in using this approach as being making use of MySQL's fulltext search capability and less work needed when updating the design of the page. I'm not sure of a few...
7
3644
by: Dave | last post by:
I have a system that basically stores a database within a database (I'm sure lots have you have done this before in some form or another). At the end of the day, I'm storing the actual data generically in a column of type nvarchar(4000), but I want to add support for unlimited text. I want to do this in a smart fashion. Right now I am leaning towards putting 2 nullable Value fields: ValueLong ntext nullable ValueShort nvarchar(4000)...
4
9906
by: Hazzard | last post by:
What is the best way to do this? Binary with 0 representing off and 1 on? Int16 with 1 representing first button, 2 the second, 3 ... varchar with a character values at certain positions in the string representing radio button values. Thanks, -hazz
14
2371
by: Joe | last post by:
Hello All: I am trying to dynamically populate a web page with literal content and controls (textboxes and checkboxes (and eventually two buttons - the buttons do not appear in the code yet). I read an xml file and, using the values retrieved from it, determine what text should be displayed and which controls should be rendered and - most importantly - where those controls should be rendered. The ultimate goal is to have some text...
5
2207
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL database, a database connection (using the SQlDataSource Web Control from the Toolbox), and created the following stored procedure in Visual Studio.Net 2005:
3
2072
by: Adrian Parker | last post by:
v1.1 and v2.0 We have a problem with viewstate not being stored. What's happening is that we create controls in CreateChildControls and add them to a container on the page (whether it be a panel or a table etc). We only set the data values for the controls if not page.ispostback. But, if either of the textboxes change, the page posts back and the changed event fires twice. Protected Overrides Sub CreateChildControls() Dim...
23
1997
by: shank | last post by:
I have the below code found on an ASP site. <% arrName = Split(Request("TextArea"),",") %> <% For i = LBound(arrName) To UBound(arrName) Response.Write "ID: " & arrName(i) & "<br>" Next %>
2
3076
by: Rick | last post by:
Let me start by saying that I know very little about JavaScript. The software that I use to convert my FrameMaker files to HTML uses a JavaScript to hide certain text. The user has to click the paragraph to display that text. Currently, that collapsed text prints only if I go ahead and expand it on my HTML page. I want to be able to have that text automatically print, regardless of whether the user has expanded it on the HTML page.
6
5859
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the values are added to the dropdown list. But when I thought of getting the selected value from the...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.