Rah*_*ain 4 sql sql-server-2008
在执行以下SQL查询时
alter table tablename add columnname boolean not null default false;
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
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字段.
在SQL中,您使用0和1设置bit字段.这些值在SQL Server Management Studio中显示为false或true对应于0和1.
alter table tablename add columnname bit not null default 0;
Run Code Online (Sandbox Code Playgroud)