robert030975
MIS
- Oct 17, 2006
- 227
HI
Was looking at creating a table where to use the default constraint.
CREATE TABLE Customer
(
CustomerID INT CONSTRAINT pk_customer_cid PRIMARY KEY,
CustomerName VARCHAR(30),
CustomerAddress VARCHAR(50) CONSTRAINT df_customer_Add DEFAULT 'UNKNOWN'
)
If I insert
Insert into Customer
Values ( 113, NULL,NULL)
select * from Customer
The customer adress comes up as NULL as opposed to 'UNKNOWN'
I thought about specifying
CustomerAddress VARCHAR(50) CONSTRAINT df_customer_Add NULL DEFAULT 'UNKNOWN'
but still does not work. Am i doing something wrong?
Was looking at creating a table where to use the default constraint.
CREATE TABLE Customer
(
CustomerID INT CONSTRAINT pk_customer_cid PRIMARY KEY,
CustomerName VARCHAR(30),
CustomerAddress VARCHAR(50) CONSTRAINT df_customer_Add DEFAULT 'UNKNOWN'
)
If I insert
Insert into Customer
Values ( 113, NULL,NULL)
select * from Customer
The customer adress comes up as NULL as opposed to 'UNKNOWN'
I thought about specifying
CustomerAddress VARCHAR(50) CONSTRAINT df_customer_Add NULL DEFAULT 'UNKNOWN'
but still does not work. Am i doing something wrong?