By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,766 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,766 IT Pros & Developers. It's quick & easy.

enum data type

100+
P: 144
hi,

can we have a enum datatype for a column in a table?
i need to store the position of an employee in the 'employee' table. there'll be just 5 positions available such as 'cashier, storage, admin, owner, etc..'.

for some reason i couldn't create another table to hold the position information and have a foreign key in the 'employee' table to that position table.

i thought i could use an enum data type. i want to hear from you guys, what datatype will suit this requirement. any comment and recommendation will be appreciated.

Thank you.
Oct 22 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878
What error are you getting?

Try:

1. Create your POSITION table. Use tinyint as your PositionID (PK).
2. Insert records to your POSITION table.
3. Modify your EMPLOYEE table.Add a new column PositionID. Do not make it an FK yet.
4. Update your EMPLOYEE table for the proper PositionID based on POSITION table.
5. Make the Employee.PositionID as FK to Position.PositionID

Happy coding!

-- CK
Oct 22 '08 #2

100+
P: 144
hi,

thanks for the reply.
actually the reason that i couldn't create the Position table is not because errors while creating the Position table, it's the customer demand. i think i'll try to discuss this with the customer.

Thank you.
Oct 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.