On executing the following SQL query
alter table tablename add columnname boolean not null default false;
I got the following error message:
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.
How should I fix this? Suggestions?
The column type should be a bit
field.
In SQL you use 0
and 1
to set a bit
field. The values are displayed in SQL Server Management Studio as false
or true
, corresponding to 0
and 1
.
alter table tablename add columnname bit not null default 0;
There is no boolean
data type. Use the bit
data type.
The false
value for a bit
is 0
.
alter table tablename add columnname bit not null default 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With