Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Unanswered: Transfer Data in two tables

    Hi,

    I am have a two tables. I want to transfer data from Table1 to Table2 but depending on BRK_TITLE. For example, if BRK_TITLE is "Testing" then table1.BRK_QUANT would go to Table2.Qty1, if BRK_Title ="My Testing" then it would go to table2.qty2 and so on...
    but problem is every time BRK_TITLE changes. these are not constant titles(e.g. title may be 'abc', '134' etc)

    If data belongs to title3 then it would go to the specific quantity i.e. table2.qty3

    Table1:
    DB_CONTRACT
    ITEM_NO
    BRK_TITLE
    BRK_QUANT
    ----
    table2:
    DB_CONTRACT
    ITEM_NO
    BRK_TITLE
    qty1,
    qty2,
    qty3,
    qty4,
    qty5,
    qty6,
    qty7,
    qty8

    I hope i convey my point of view?

    I'll really appreciate your help
    mr_roomi

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Perhaps I misunderstand your question. Does the value of BRK_Title change periodically? or did you simply mean that each row has a different value?

    Depending on the answer to this question, you could simply write two queries to push the data into the appropriate table based on whatever values you determine (if the data in BRK_Title does not change).

    Otherwise, I suppose you could write two FOR UPDATE triggers (one for each table) that would ensure that if the newly updated value of BRK_Title met a select criteria, it gets transferred to the other table.

    Now that I think of it, it may need to be an INSTEAD OF trigger.

    regards,

    hmscott

Posting Permissions

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