Results 1 to 3 of 3

Thread: Another SQL-Trigger-Problem

  1. #1
    Join Date
    Dec 2005
    Posts
    2

    Another SQL-Trigger-Problem

    Hi @all,
    Friendly Greetings From Vienna, Austria.

    I'm rather new to MS-SQL but was working 6 years with Progress RDBMS, so I know "a bit" about databases (and normalization), but nearly nothing about the specialities of MS-SQL.
    I'll try to explain my problem (it's about the multiple-update-triggers):

    I've got a DB grown for years with some dozens of tables and many dozens of views (I'm now new to this db, but I've to handle with it )
    in the "Equ"-Table (what's all dealing with) there are some columns which should be transferred into a reference table but because of the big number of views referring to these fields I don't want to delete them.
    So I have to keep them consistent relative to the reference-table.
    I made a new column "TAG_F" which is a unique key in the reference table "TagDef" (which contents won't be altered in near future)
    So now each change in the "Equ.Tag_F" should cause a change in the fields "Equ.Tag_F_1" and "Equ_Tag_F_2". These should be updated with the corresponding fields in the "TagDef"-table.
    For single-row updates it works fine
    (find the right record in "TagDef", get all necessary fields and update the "Equ")
    but I'm not able to find the right statement for the trigger when more than one row is changed (and of course the different rows could change to different "Tag_F")

    I hope the description is clear enough and somebody will find a solution.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Sounds like you need a cursor to go through the affected rows and updated other tables.

  3. #3
    Join Date
    Dec 2005
    Posts
    2
    Thank you,
    after googleing a bit for this I think this is what I need.

Posting Permissions

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