View Single Post
  #2 (permalink)  
Old 07-30-2008, 11:10 PM
zoul's Avatar
zoul zoul is offline
Moderator
 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 70
Send a message via AIM to zoul
Thumbs up

I would suggest doing this:

Alter the table, add an ADDITIONAL enum value
Update the table, set all 'Administrator' to 'Executive'
Alter the table, remove the 'Administrator' enum value

Although, personally ... I would use the simple 'EmployeeType' table and do a join -- and, if the values 'Executive', 'Administrator', etc ... are just that, 'Lookup Values' -- then simply store all your lookup values in a single table, not one table for each one.

create table EnumValues (
EnumValueId int,
EnumValueGroup varchar(255),
EnumValueField varchar(255),
EnumValueFieldId varchar(255)
);

Then simply store a reference to 'EnumValueId' in the Employee table, and populate the 'EnumValues' table like so:

insert into EnumValues(EnumValueGroup, EnumValueField, EnumValueFieldId)
values('Employee Type', 'Executive', 0);

You can use the 'EnumValueId' in your application code to match to an actual Enum or low-number constant and use the EnumValueId to keep your referential integrity in the database.


The initial idea would solve your 'null value' issue -- especially if the field your updating allows nulls to begin with.

-- MoZ
__________________
-- David Higgins
http://www.fragmentedcode.com
http://www.zoulcreations.com
Reply With Quote