SQL Server:位列的默认值未应用?(SQL Server : bit column's default value is not applied?)

我有一个表格,它具有NOT NULL和默认值0布尔列。

但是,我在插入查询时遇到了515错误而未指定这些列。

常规错误:515一般SQL Server错误:检查来自SQL Server的消息[515](严重性16)[(null)]

(SQL:插入[some_table]([uid],[gmt_offset],[locale],[updated_at],[created_at])值(122,7200,en_US,2016-01-15 18:42:57.000,2016- 01-15 18:42:57.000))'

I have a table which has boolean columns with NOT NULL and with default values 0.

However I'm getting an 515 error on insert query without specifying those columns.

General error: 515 General SQL Server error: Check messages from the SQL Server [515] (severity 16) [(null)]

(SQL: insert into [some_table] ([uid], [gmt_offset], [locale], [updated_at], [created_at]) values (122, 7200, en_US, 2016-01-15 18:42:57.000, 2016-01-15 18:42:57.000))'

最满意答案

没有看到你的代码,但查找515, 它说 :

错误515 SQL Server 2000错误515严重级别16

消息文本 无法将值NULL插入到'%。* ls'列'%。* ls'列中。 列不允许有空值。 %ls失败。

说明 在尝试在插入或更新不允许空值的列时使用空值时,会在运行时发生此错误。

你确定你没有指定NULL吗?

Without seeing your code, but looking up 515, it says:

Error 515 SQL Server 2000 Error 515 Severity Level 16

Message Text Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails.

Explanation This error occurs at run time when an attempt is made to use a null value while inserting or updating a column that does not allow null values.

Are you sure you are not specifying a NULL?

更多推荐