every time a job is created I want to make a work order assigned to that job and few operations assigned to that work order.
I am writing an insert trigger on JOBS table that will create a record in WORK ORDERS and OPERATIONS tables.
JobID is a FK in WORK ORDERS table
WorkOrderID is FK in Operations.
I know how to grab the JobID in the trigger using "inserted" but how do i grab the WorkOrderID from the record i just created in workorders to make an Operation record?
This is the code so far (simplified)
declare @jobnumber as int
select @jobnumber = (select jobID from inserted)
insert into workorders