Storing Multiple Values

  • Dear Sql Gurus,

    I have some serious problems and it is causing performance issues.

    I have a master table which has a field called locality.

    The user registers. He has the facility to register himself in more than one location.

    So his details are entered as a single entry in the Master Table.

    along with multiple location IDs. For example (234,546,645,867)for a single User entry

    and these IDs are mapped to a location table which is as follows

    locationmaster

    id locationname city

    234 aaa C1

    546 bbb C1

    645 ppp C1

    867 ppp C1

    In order to pick the location name i need to split the Id (comma separator) and then match with

    the locationmaster and then get the location names.

    I Know this is not the ideal / efficient way to store.

    Please can any one suggest smart/efficient way to solve. Or is there any new features in Sql Server 2005 Server offers.

    I would be thankful if some one can give me hints.

    Regards

    Venkat

  • search this site for the split function

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • In terms of design I would have 3 tables

    1. Location

    2. User

    3. LocationUserMap

    This means that locations and users are independent and the relationship between them is held in the mapping table.

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

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