October 4, 2012 at 5:27 am
Hi Experts,
I created a default constraint with value (0) on BIT datatype and NOT NULL column. In the insert list i have not specified the column name. I guess it should take default value (0). But its throwing me a error
"Cannot insert NULL values". Please help me in resolving this.
Thanks in advance.
Regards,
Vijay
October 4, 2012 at 5:31 am
Vijay
Please post your full INSERT statement and the DDL for your table.
Thanks
John
October 4, 2012 at 5:54 am
I don't think there should be a problem. Here is the sample code which executed perfectly
CREATE TABLE dftBIT
(
id INT,
flag BIT NOT NULL DEFAULT(0)
)
INSERT INTO dftBIT
(id)
VALUES (1)
SELECT *
FROM dftBIT
In-case you face trouble kindly post associated DDL and DML.
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply