My suggestion would be to include a boolean field in your state and country
tables to control whether they are selectable or not. When you select from
those tables to display them to the end user then select only where the
boolean is set to whichever you regard as "selectable". Then disallow any
dba's/what-have-you from being able to delete entries from the state/country
tables. Maybe make a tiny web interface to allow them to set the boolean flag.
This way you keep critical user data in the system but can also "remove" a
country/state as a selectable option for future customers/users.
If you decide not to have referential intergity on these tables (in order to
keep the all-important user data) then I would suggest using LEFT OUTER JOINs
in retrieveing the information, in that manner you would receive valid
state/country values for the users that still had valid assignments, but
would eceive nulls for users that did not. If you used an inner join you
wouldn't receive those users' data back because the data ould not match the
keys in the accompanying state/country tables.
-T
"ja***@catamaranco.com" wrote:
Tables:
=====
User
------
ID
Name
NationID
StateID
Nation
-------
ID
Nation
State
-----
ID
Question:
Should an asp database solution enfore referential integrity on control
tables like:
- country
- State
....in a primary Website User Table [Users]?
Or,
Should these be hard-coded into the web page and simply inserted into the
Piimary [User] Table:
User
----
ID
Name
Nation
State
Why do I ask?
----------------
By enforcing a relationship between the tables I am creating extra work for
future stored procedures and allow for possible errors when inserting a new
registrant
into my system if for some reason one of the control table values was
deleted without cascading it to the Primary?
Appreciate any advice on this scenario...
Thanks
Jason