Insert null into not null column with default FIREBIRD

三世轮回 提交于 2019-12-10 21:52:45

问题


Inserting null into not null column with default is giving me a validation error instead of taking the default value. I don't want to make on before triggers to all of the tables. Is there any other way to do this?

Firebird 2.1.3


回答1:


The default value is used when you omit a field in the insert, not when you include the field with a null value.

Example:
Uses default for Name:

insert into SomeTable (Id) values (42)

Tries to insert null into Name:

insert into SomeTable (Id, Name) values (42, null)


来源:https://stackoverflow.com/questions/3716036/insert-null-into-not-null-column-with-default-firebird

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!