Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 disallow_zero_length

Author  Topic 

diana13
Starting Member

6 Posts

Posted - 2007-02-19 : 04:25:15
Hi,

I've made a conversion of my access database to sql.
In access I have 2 tables (for e.g.), table1 and table2, both contain one column that allow zero length.
After I made the conversion, the proprieties of the two columns seems to be the same, but in one table I can insert values with zero length, in the other I receive the following error:

The INSERT statement conflicted with the CHECK constraint "SSMA_CC$T_ART$artImg$disallow_zero_length".

What can I do? I want to be able to insert zero length if I don't have anything to insert in that field.

I hope you understand my problem, my English isn't so good.

Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-19 : 04:29:10
Remove the CONSTRAINT.
Are you using SQL 2005 or SQL 2000?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

diana13
Starting Member

6 Posts

Posted - 2007-02-19 : 04:33:57
SQL 2005.

How can I remove the constraint? I'm new to sql and I don't know many things.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-19 : 04:38:33
Try

ALTER TABLE DROP CONSTRAINT SSMA_CC$T_ART$artImg$disallow_zero_length

in a query window.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

diana13
Starting Member

6 Posts

Posted - 2007-02-19 : 04:52:02
It works.

Thank you very much.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-19 : 08:10:15
Or you can simply disable the constraint:

ALTER TABLE <tableName>
NOCHECK CONSTRAINT <constraint-name>


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -