在 MS Access 中如何处理布尔类型列中的 NULL 值?

发布于 2024-07-06 01:27:01 字数 66 浏览 6 评论 0原文

我想知道除了将列数据类型更改为整数之外,是否有更好的方法来解决 MS-Access 无法处理布尔值的 NULL 问题。

I was wondering if there is a better way to cope with MS-Access' inability to handle NULL for boolean-values other than change the column-data-type to integer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

与往事干杯 2024-07-13 01:27:01

并不是我发现的:( 我已经有一段时间没有编写 Access 了,但我记得涉及相当多的 isNull 检查。

Not that I've found :( I haven't programmed Access in awhile, but what I remember involves quite a lot of isNull checks.

一腔孤↑勇 2024-07-13 01:27:01

我认为这取决于您希望您的应用程序/解决方案如何解释数据中的空值。

您是否想在报告中简单地“忽略”它们...即有它们打印为空格或换行符? 在这种情况下,您可以在 SQL 生成器或常规 Access 查询设计器中的列中使用方便的 IsNull 函数以及“立即 if”iif(),如下所示:

IIF(IsNull(BooleanColumnName), NewLine/BlankSpace/Whatever, BooleanColumnName)

另一方面,如果您想要要将 NULL 视为“False”值,您最好更新列并使用以下内容更改它们:

Update table
SET BooleanColumnName > = FALSE
WHERE BooleanColumnName IS NULL

I think it depends on how you want your app/solution to interpret said NULLs in your data.

Do you want to simply "ignore" them in a report... i.e. have them print out as blank spaces or newlines? In that case you can use the handy IsNull function along with the "immediate if" iif() in either the SQL builder or a column in the regular Access query designer as follows:

IIF(IsNull(BooleanColumnName), NewLine/BlankSpace/Whatever, BooleanColumnName)

On the other hand, if you want to consider the NULLs as "False" values, you had better update the column and just change them with something like:

Update table
SET BooleanColumnName = FALSE
WHERE BooleanColumnName IS NULL

£冰雨忧蓝° 2024-07-13 01:27:01

我认为您必须使用数字,因此,Allen Browne,Access MVP 似乎确实如此。

I think you must use a number, and so, it seems does Allen Browne, Access MVP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文