denormalize data in a temporary table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hans Bampel

    denormalize data in a temporary table

    hello group,

    i want to denormalize data in a temporary table for a second
    business-system which cant read related datas

    what i have:
    table Partner: (Id_Partner, NamePartner, ...)
    table PartnerProduct: (Id_PartnerProd uct, NamePartnerProd uct, ...)
    table Partner2Partner Product: (Id, Id_Partner, Id_PartnerProdu ct)

    Partner to PartnerProduct ist n:m relation (thats why i need
    Partner2Partner Product)

    and the temporary table
    TempPartner: (Id_Partner, NamePartnerProd ucts)
    whereas NamePartnerProd ucts should contains a comma separated list of
    the PartnerProduct-Names

    what i need:
    a trigger or combination of trigger and SP which
    operate like the following:
    if on Partner2Partner Product is a Insert or Update made, then Delete
    the row in TempPartner which has the Id of the Partner, and then
    create a new row which contains all n:m joined PartnerProduct-Names in
    it.

    i hope the intention and problem are clear.

    thanx for answers,
    hans
  • Simon Hayes

    #2
    Re: denormalize data in a temporary table


    "Hans Bampel" <web-accounts@gmx.de > wrote in message
    news:73ce18be.0 406170455.1790a c7b@posting.goo gle.com...[color=blue]
    > hello group,
    >
    > i want to denormalize data in a temporary table for a second
    > business-system which cant read related datas
    >
    > what i have:
    > table Partner: (Id_Partner, NamePartner, ...)
    > table PartnerProduct: (Id_PartnerProd uct, NamePartnerProd uct, ...)
    > table Partner2Partner Product: (Id, Id_Partner, Id_PartnerProdu ct)
    >
    > Partner to PartnerProduct ist n:m relation (thats why i need
    > Partner2Partner Product)
    >
    > and the temporary table
    > TempPartner: (Id_Partner, NamePartnerProd ucts)
    > whereas NamePartnerProd ucts should contains a comma separated list of
    > the PartnerProduct-Names
    >
    > what i need:
    > a trigger or combination of trigger and SP which
    > operate like the following:
    > if on Partner2Partner Product is a Insert or Update made, then Delete
    > the row in TempPartner which has the Id of the Partner, and then
    > create a new row which contains all n:m joined PartnerProduct-Names in
    > it.
    >
    > i hope the intention and problem are clear.
    >
    > thanx for answers,
    > hans[/color]

    The usual answer is that you should handle this in a client tool, rather
    than in the database itself. There are ways to do it, but the only really
    reliable way is a cursor (and if you need the comma-separated list in an
    order, it's probably the only way), and cursors are slow:



    Simon


    Comment

    Working...