• It's not completely necessary to use a textual method for identifying the group of related codes.

    Similarily, having a status based on a textual value is also not ideal.

    eg.

    Use one table to contain a list of all the possible Code Groups :-

    CREATE TABLE [dbo].[tbl_Code_Group] (

     [Code_Group_Id] [udt_Code_Group_Id] IDENTITY (0, 1) ,

     [Code_Group_Descr] [udt_Descr] NOT NULL ,

     [Code_Group_Type] [udt_Code_Id] NOT NULL ,

     [Code_Group_Status] [udt_Code_Id] NOT NULL ,

     [Code_Group_Purpose] [udt_Text] NULL ,

     [Create_Date] [udt_Date_Time] NOT NULL ,

     [Create_User] [udt_User_Id] NOT NULL ,

     [Update_Date] [udt_Date_Time] NOT NULL ,

     [Update_User] [udt_User_Id] NOT NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    Another is used to contain all the possible codes :-

    CREATE TABLE [dbo].[tbl_Code] (

     [Code_Group_Id] [udt_Code_Group_Id] NOT NULL ,

     [Code_Id] [udt_Code_Id] NOT NULL ,

     [Language_Id] [udt_Language_Id] NOT NULL ,

     [Code_Descr] [udt_Descr] NOT NULL ,

     [Code_Descr_Short] [udt_Descr_Short] NULL ,

     [Code_Mnemonic] [udt_Code_Mnemonic] NULL ,

     [Code_Text] [udt_Text] NULL ,

     [Code_Type] [udt_Code_Id] NOT NULL ,

     [Code_Status] [udt_Code_Id] NOT NULL ,

     [Code_External_Ref] [udt_Code_External_Ref] NULL ,

     [Code_Display_Status] [udt_Code_Id] NOT NULL ,

     [Create_Date] [udt_Date_Time] NOT NULL ,

     [Create_User] [udt_User_Id] NOT NULL ,

     [Update_Date] [udt_Date_Time] NOT NULL ,

     [Update_User] [udt_User_Id] NOT NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    NB: All columns with "_Id" are of type Integer.

    Provided you know the numeric Code_Group_Id you can always retrieve the appropriate Codes for the Code Group. Having additional fields for external refernces / Mnemonics where they are needed implies you can lump it all into this one table.

    If you then write an object class to deal with the Codes it is very simple to encorporate all the appropriate functionality of the tables into your application using fairly straightforward programming constructs.

    The Use of a Language_Id in the second table facilitates support for multiple language applications.

    Note, The Code_Status is itself another Code_Group_Id as is the Code_Type and Code_Display_Status.

    Basically, I never use any non-numeric keys for any form of codes. They are always translated through the Code table. Keeps life really simple.

    Lots of ways to skin the cat I suppose.