我有SQL Server 2014和大学我想要在我所有的表上实施软删除。实施软删除
SET DATEFORMAT dmy
CREATE TABLE Customers
(
CustomerId int IDENTITY (1,1) not null,
FirstName varchar (20) not null,
LastName varchar (30) not null,
Address1 varchar (30) not null,
Address2 varchar (30) not null,
Address3 varchar (30) null,
Eircode varchar (8) null,
DateOfBirth date not null,
CountyId int not null,
CountryId int not null,
AssociationId int null,
CustomerTypeId int not null,
AccountId int not null
)
我想添加一个软删除列使用删除在。做这个的最好方式是什么?
建议您在数据库的所有表上使用软删除(deleted_at
)以保持一致。
你还记得申报外键吗? – Schwern