well hello again after a few months
after i changed work i went from access to sql server 2016 and i am still not familiar with a few things one of that is triggers
so here is my question
i have a table named ownership
it has 4 columns
Ownership _ID
Ship_ID
Person_ID
percentage
what i want is a trigger that it wont allow a record to be inserted if the sum of percentage is over 100 for its ID
if (select sum(percentage) from ownership
where Ship_ID = @Ship_ID ) >100
raise error ="ownership can't be more than 100%"
rollback
the question is how do i get the ship ID within the trigger ?
after i changed work i went from access to sql server 2016 and i am still not familiar with a few things one of that is triggers
so here is my question
i have a table named ownership
it has 4 columns
Ownership _ID
Ship_ID
Person_ID
percentage
what i want is a trigger that it wont allow a record to be inserted if the sum of percentage is over 100 for its ID
if (select sum(percentage) from ownership
where Ship_ID = @Ship_ID ) >100
raise error ="ownership can't be more than 100%"
rollback
the question is how do i get the ship ID within the trigger ?