使用默认FIREBIRD将null插入不为null的列 [英] Insert null into not null column with default FIREBIRD

查看:81
本文介绍了使用默认FIREBIRD将null插入不为null的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在默认情况下将null插入不为null的列会给我一个验证错误,而不是使用默认值. 我不想在触发所有表之前进行讨论.还有其他方法吗?

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

Firebird 2.1.3

推荐答案

在插入中省略字段时使用默认值,而不是在包含空值的字段时使用默认值.

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

示例:
Name使用默认值:

Example:
Uses default for Name:

insert into SomeTable (Id) values (42)

尝试将null插入Name:

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

这篇关于使用默认FIREBIRD将null插入不为null的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆