Enumeration in SQL2005

  • HI Everyone,

    Im designing a table which has items that will vary in colour,size ,wood etc. Is it possible to have a enum arrangement for a column in a datatable?

    ta

  • yes and no.

    you can create a table with the a primary key and the list of possible values.

    then in the main table, you store the key from that table as a foreign key.

    when you query the data, you have the option of joining the table with the lookup so you get the description.

    When you are entering the data, the actual selection would need to come from a presentation layer, nothing native to SSMS, for example.

    I use DeveExpress grids in my .NET application,which natively support replacing the normal text editing cell with any kind of Edit Control...a drop down menu, calendar date picker, many other options....in the case of a lookupedit drop down, i change it's data source to the lookup table, it it allows the user to select by name, but stores the data with the key.

    vidhyasudha (4/16/2009)


    HI Everyone,

    Im designing a table which has items that will vary in colour,size ,wood etc. Is it possible to have a enum arrangement for a column in a datatable?

    ta

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • You may want to check out the below link

    http://qa.sqlservercentral.com/articles/Miscellaneous/3174/

  • Thank you for your response. It did certainly help.

    Vids

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply