0

我努力了:

CAST(NULL AS DATETIME) AS Exit_T.

给我以下错误:

将 char 数据类型转换为 datetime 数据类型会导致 datetime 值超出范围。

我们可以为DateTime字段分配空值吗?在查询达到某些条件后我需要这个

4

2 回答 2

2

What are you trying to do? You don't typically use NULL in a cast. You would assign the keyword NULL to the value of the field. Nulls are acceptable in DateTime fields if you allow it.

于 2012-12-11T03:08:33.770 回答
1

如果datetimefield 是NULL-able 字段,我们可以分配NULL值,否则,我们不能分配NULL值。

看看问题在于演员阵容,而必须来自其他地方:

select CASE(NULL AS DATETIME) AS Exit_T;
于 2012-12-11T03:01:25.670 回答