New answers tagged dml
2
Imposing such rules on db level can be very expensive in terms of resources, so I don't think there is a standard way which will work everywhere.
I cannot suggest anything better than raising an error inside the body of BEFORE DELETE trigger (or AFTER DELETE, but BEFORE trigger seems to be more appropriate in this case). Unfortunately, it's quite RDMS ...
3
I can only speak for SQL Server, but the only way this could be done is through a DML trigger (as far as I know). Take the below for example:
use TestDB;
go
create table dbo.TestTriggerTable
(
id int identity(1, 1) not null,
some_int int not null
default 1
);
go
insert into dbo.TestTriggerTable
default values;
go 1000
create trigger ...
Top 50 recent answers are included