-
strange `default` problem
I am having problems with using a default value for table columns - see code below:
set ansi_defaults on
create table hbd1
(a integer,
b integer default 0
)
insert into hbd1
(a) values (1)
select * from hbd1
gives results:
(1 row(s) affected)
a b
----------- ----------
1 (null)
(1 row(s) affected)
amending the code to
set ansi_defaults off
create table hbd1
(a integer,
b integer default 0
)
insert into hbd1
(a) values (1)
select * from hbd1
gives results:
Msg 233, Level 16, State 2
The column b in table hbd1 may not be null.
Anyone help with why the column is not applying the default value ???
TIA
Harry Dickinson
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|