sql server - Update newly inserted non-nullable foreign key, with inserted value of a trigger -


i not know if possible.

at moment have following trigger:

create trigger trig_insert_a on insert begin declare @expdate datetime2; declare @identifier uniqueidentifier; set @expdate = dateadd(year, 1, getdate()); set @identifier = newid(); insert b(uniquevalue, expirationdate) values (@identifier, @expdate); end 

[edit]

the previous trigger create record in table "b", when new record created in table "a". kinda trying achieve, maybe should try explain other way around: before insert table "a", want create record in table "b", take id of newly created record in "b", , set "fk_bid" value.

enter image description here

[/edit]


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -