May 2, 2002 at 11:46 am
I need to write a trigger to update the identity column in the 2nd table if a new row is added to the first table's identity column.
Here's what I have (doesn't work)
create table x (col1 numeric)
create table z (col1 numeric)
CREATE TRIGGER trigger_name
ON x
FOR INSERT, UPDATE
AS
If UPDATE(col1)
BEGIN
update z set col1= x.col1 from x
END
GO
insert into x values (6)
May 2, 2002 at 12:50 pm
Duplicate post, see reponses in http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=3982&FORUM_ID=5&CAT_ID=1&Topic_Title=trigger+to+update+2nd+table&Forum_Title=Administration
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy