Can we define bit columns as NULL?
In according Reference manual :
BIT data type
BIT stores only the values 0 or 1
Inserting any nonzero value into a BIT column stores a 1 in the column. Inserting any zero value into a BIT column stores a 0.
Only the default index type is supported for BIT data.
Bit Data Type Compatibility
SAP Adaptive Server Enterprise, SAP SQL Anywhere and SAP IQ support the BIT data type, with differences.
The differences are:
- SAP SQL Anywhere permits only 0 or 1.
- SAP Adaptive Server Enterprise BIT data types only allow 0 or 1 values.
- SAP ASE and SAP IQ implicitly convert integral data types to BIT. Nonzero values are stored as 1 (TRUE).
But for create table:
CREATE TABLE Statement Usage Considerations
When creating tables for compatibility, be aware of the following compatibility considerations for NULL treatment, check constraints, referential integrity, default values, identify columns, computed columns, temporary tables, and table location.
NULL in Columns
For compatible treatment of NULL:
- SAP SQL Anywhere and SAP IQ assume that columns can be null unless NOT NULL is stated in the column definition. You can change this behavior by setting the database option ALLOW_NULLS_BY_DEFAULT to the Transact-SQL compatible setting of OFF.
- SAP SQL Anywhere and SAP IQ assume that BIT columns cannot be NULL.
- SAP Adaptive Server Enterprise assumes that columns cannot be null unless NULL is stated.
You cannot define a column with a BIT data type as a UNIQUE or PRIMARY KEY constraint. Also, the default for columns of BIT data type is to not allow NULL values; you can change this by explicitly defining the column as allowing NULL values.
SAP IQ 16.1
IQ BIT bit datatype column nullable NULL treatment compatibility ALLOW_NULLS_BY_DEFAULT , KBA , BC-SYB-IQ , Sybase IQ , Problem
About this pageThis is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).
Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.