标签:enc com serve clu cas const null create compute
1. computed column
alter table tableName add columnName as (cast(aColumn as float) / bColumn * 100) persisted;
2. unique nullable
create unique nonclustered index[UniqueName] on [tableName]([columnNameA] asc) where ([columnNameA] is not null);
3. foreign key cascade delete
alter table [tableNameA] drop constraint [FKName]; alter table [tableNameA] with check add constraint [FKName] foreign key(foreignColumnName) references [tableNameB]([Id]) on delete cascade -- or on delete set null;
4. reset auto increment
dbcc checkident (‘tableName‘) --check current dbcc checkident (‘tableName‘, reseed, 0); --reset to 0 , next is 1
标签:enc com serve clu cas const null create compute
原文地址:https://www.cnblogs.com/keatkeat/p/9574720.html