Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    6

    Unanswered: Content Manager - adding multiple attribute values

    Hi,

    We have an item which contains account information as attributes e.g, account number, acct name, itemid, date etc. Is it possible to add multiple values to an attribute? If yes, how? Specifically, I would like to add multiple account numbers to an account name.
    Pls. advise...

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Your system wouldn't be even in Normal Form 0 if you would store multiple values in one filed.

    Redesign your datamodel.

    Go from

    TABLE account_item
    name VARCHAR(50),
    account INTEGER,
    ....

    (with no way to store or retrieve multiple values into/from one INTEGER field. You would have to rely on a CHAR or VARCHAR field to store multiple values, you would also have to convert the number to and from a string to store or retrieve the value, how would you access the third value, .... a real nightmare)

    to

    TABLE account_item
    ID INTEGER,
    name VARCHAR(50),
    ....
    with primary key (ID)

    TABLE account_item_accNr
    ID_account_item INTEGER,
    nr_account INTEGER,
    ....
    with primary key (ID_account_item, nr_account)
    and foreign key (ID_account_item) that references account_item (ID)

    For each account number you want to store, you just add one account_item_accNr record that references to the correct account_item record.

    Going from your problem to this solution is a basic datamodelling skill. I'd recommend reading a good book about datamodelling or taking a course. It's not that hard to learn, but you really should master it before proceeding.

    You should really have a good grab about normalising tables before doing anything in a production environment. Otherwise you will hit the wall and you will hit it hard. A normalised datamodel is easy(er) to expand, modify, update, query, ... , anything else will make it LOTS and lots harder.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Aug 2006
    Posts
    6
    Hi Wim,
    Thanks for the reply. I appreciate your effort in providing a detailed reply to my question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •