Triggers

  • Hello every one:

    I'm new to SQL and I want to know how can I do de following:

    I have to tables: Tabl1 contains 2 fields (F1 and F2); Tabl2 contains 2 fields too (Table and ValueF1). In Table there is a name of one table and in ValueF1 there is a numeric value that will be the value that F1 will take when a new record be inserted in Table.

    How can I do in a trigger that when a new record be inserted in Tabl1:

    1. The value of the field F1 (in Tabl1) be the value of ValueF1 (in Tabl2).

    2. Update the value of ValueF1 (in Tabl2) making it equal to ValueF1+1.

    Thanks in advanced,

    Fernando

  • Would this help?

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=19593

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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