enum data type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    enum data type

    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.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    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.Positi onID as FK to Position.Positi onID

    Happy coding!

    -- CK

    Comment

    • thesti
      New Member
      • Nov 2007
      • 144

      #3
      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.

      Comment

      Working...