bind
IS-IT--Management
- Dec 13, 2004
- 25
Hello all,
I'm having problems creating a trigger for the following task,
I have a table called dbo.users, I'm going to be creating a trigger on this table and in the trigger I need it to grab the newly inserted "UserID" field and put it into a variable called @UserID.
Then I have to do a select statement to select all of these FormID's from another table called dbo.form_tbl. It may return 10 or so records, maybe more. then I need to put those returned FormID's into a variable named @FormID and for EACH row returned, need to do a insert into a table named dbo.StatusUsers where the values will be (@UserID, @FormID, '0','0')
But it needs to do this for each record returned from the above select statement in dbo.form_tbl.
I'm having a heck of a time writing the actual trigger, any help on this would be greatly apprecieated.
Thanks all
I'm having problems creating a trigger for the following task,
I have a table called dbo.users, I'm going to be creating a trigger on this table and in the trigger I need it to grab the newly inserted "UserID" field and put it into a variable called @UserID.
Then I have to do a select statement to select all of these FormID's from another table called dbo.form_tbl. It may return 10 or so records, maybe more. then I need to put those returned FormID's into a variable named @FormID and for EACH row returned, need to do a insert into a table named dbo.StatusUsers where the values will be (@UserID, @FormID, '0','0')
But it needs to do this for each record returned from the above select statement in dbo.form_tbl.
I'm having a heck of a time writing the actual trigger, any help on this would be greatly apprecieated.
Thanks all