Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    67

    Unanswered: Normalized Data, Not

    My boss what’s me to collect data in a way that will allow him to view it in a non-normalized view...

    name phone_type_1, sn_phone_type_1, phone_type_2, sn_phone_type_2, phone_type_3, sn_phone_type_3...

    He does NOT want...

    name, phone_type, sn_phone_type
    Bill ATT XX44YY
    Bill ATT QQ66TT
    Bill DELL 77JJ88

    So how can I collect the data in a normalized fashion, then display it in the format he desires? If possible I really didn't want to write code to step through the records splitting them up, I’d like to use SQL.

    Thanks in advance for your suggestions.

  2. #2
    Join Date
    Feb 2003
    Posts
    15

    Re: Normalized Data, Not

    Collect it normalized like you want to. Then go like this:

    declare @foo varchar(8000)

    select @foo = coalesce (@foo + ',', '')
    + phone_type + ',' + sn_phone_type
    from persontable where name = 'Bill'

    select @foo

    or something like that.

Posting Permissions

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