Domain fields

  • How can I implement "Domain fields" or "Reference fields"?

    A "Domain field" or a "Reference field" would be the base field on which other fields would be "Referenced".

    For example, I could create a "Domain field" called "YesNO" of type "bit" with a default value of No. Now I can create a field called "Employee Absent" and base that on "YesNo". Hence all the defaults are automatically applied to my new field.

    If my business rule changed (say now instead of "bit", I made it a type "char" for Yes, No, Maybe, Don't know, etc.), I would only have to modify the "Domain field" and all the fields that were based on this field would automatically have this new rule.

    Can I create a field without including it in a file?

  • Not completely sure, if I understand you correctly, but in SQL Server 2000 you can have user-defined data types, which to a certain degree might do what you want. You can read about it in BOL.

    However, once you've defined your own data type and use it in your tables, you can't simply switch the underlying data type in the user-defined data type, because it is bound to the tables.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Sounds like creating a "domain field" is not a standard practice in SQL.

    Is there any resource which shows standard practices such as naming convention suggestions for files, fields, stored procedures etc. Also some standard functions and some tips in designing a table.

    Right now this is what I do:

    Say, I want to create a new table. I use the Import/Export function to copy the table to another table and then modify/add/delete the fields as required. Would you consider this a standard practice or something better is recommended?

  • Great. I'll be looking for that. Also, could you recommend a good "cook book" for stored procedures for sql server? Is there any book out there that takes a business case and solves it? Something like VB 6 from Scratch by Bob Donald and Gabriel Oancea.

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

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