Jump to content

Update both tables


haibec
 Share

Recommended Posts

I have two Table : Student include field : ID ,NAme,classs an a Table :Point include ID ,Point, name,class . I want when Update a table ,exemple : Student then The table Point so-so updated!Please help me
Hope this useful. I tried and it worked
Create trigger St_update on Studentfor updateAs update Point set [iD]=(select [iD] from Inserted), [Name]=(select [Name] rom Inserted), Class=(select Class from Inserted) where [iD]=(select [iD] from Deleted)

Your Student table should have primary key. In this case I chose ID as primary key

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...