在执行以下 SQL 查询时
alter table tablename add columnname boolean not null default false;
我收到以下错误消息:
The name "false" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
我应该如何解决这个问题?建议?
最佳答案
列类型应该是 bit
field 。
在 SQL 中,您使用 0
和 1
设置一个 bit
field 。这些值在 SQL Server Management Studio 中显示为 false
或 true
, 对应 0
和 1
.
alter table tablename add columnname bit not null default 0;
关于SQL : The name false is not permitted in this context,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11353962/