Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lamine
Starting Member
1 Post |
Posted - 2013-04-30 : 10:44:43
|
I would like to have an AFTER UPDATE, INSERT Trigger.I have two tables:Jobs has three fields; JobsId, JobsName, JobsAreaJobsLink has three fields; JobsLinkId, JobsLinkJobsId, JobsLinkCalculation.The two tables are linked ON Jobs.JobsId = JobsLink.JobsLinkJobsIdWhat I want is? If I update Jobs table or insert a new records in it, I want it to update or insert a records in JobsLink where JobsLinkCalculation field will simply have JobsName + '-' + JobsArea from jobs table.Please help.CheersL |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-02 : 01:39:15
|
[code]CREATE TRIGGER Trg_CreateJobLink ON JobsAFTER INSERTASBEGININSERT JobsLink(JobsLinkJobsId, JobsLinkCalculation)SELECT JobsId,JobsName + COALESCE('-' + JobsArea ,'')FROM INSERTEDEND[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|