SQL Server : want a column to be nullable only for existing and newly created rows -
is possible make column can null
beginning, once has been set non-null value can never reset null
?
i'm guessing might possible update constraint using both inserted , deleted table, seems complicated given goal of task.
bonus question: since doesn't seem easy this, sign of bad design (on part of / sql server
)?
since you're allowing filed null when row inserted, you'll have use trigger update
create trigger trigger1 on table1 update begin set nocount on declare @field1 varcahr(max) select @field1 = field1 inserted if @field1 null begin raiserror('a null values not allowed', 15, 1) rollback end end
Comments
Post a Comment