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.
Author |
Topic |
Hinduson
Yak Posting Veteran
69 Posts |
Posted - 2013-10-17 : 18:10:03
|
Please am being asked to Answer this question.OrderStatus must be any of the following Values: 'In Transit','Received' or 'Cancelled'..And This is my query Below and I had the Below Error Statement. Please can someone help me with a Better Idea?ALTER TABLE TRANSACTIONS_ORDERDETAILS ADD CONSTRAINT myConstraint CHECK(OrderStatus ='InTransit');Msg 547, Level 16, State 0, Line 1The ALTER TABLE statement conflicted with the CHECK constraint "ckconstraint". The conflict occurred in database "SHOPHERE", table "dbo.TRANSACTIONS_ORDERDETAILS", column 'OrderStatus'.Best Regards. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2013-10-17 : 19:00:33
|
It's because you already created a check constraint on that column. You can issue an ALTER TABLE DROP CONSTRAINT command to remove it. The one you want to remove is called ckconstraint, according to the error.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Hinduson
Yak Posting Veteran
69 Posts |
Posted - 2013-10-17 : 19:01:57
|
ThanksBest Regards. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-18 : 03:28:23
|
just as a sidenoteOrderStatus must be any of the following Values: 'In Transit','Received' or 'Cancelled'..if thats true then check constraint should be likeALTER TABLE TRANSACTIONS_ORDERDETAILSADD CONSTRAINT myConstraint CHECK(OrderStatus IN ('InTransit','Received','Cancelled')); ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|