Changing a table-level constraint to a column-specific constraint

Changing a table-level constraint to a column-specific constraint

Post by Ronna William » Thu, 06 Apr 2000 04:00:00



Can I change a table-level check constraint to a column-level constraint?
If so, how?  I can see in the alter table command I can drop/add table-level
constraints, but how to make it column specific?
Is there some way to do this with an Alter Table or in Enterprise Manager
without dropping/recreating the table?

I am implementing horizontal partitioning and, as in some examples I have
seen, set up the tables with table-level constraints evaluating the
accounting period (one column, YYYYMM) for the year/month.  When I set up my
view to union all the tables, the query plan shows that it is looking at the
clustered index (accounting period is the high-level node of the index) for
each table.  When I define the same tables with the check constraint on the
accounting period column itself (rather than table-level constraint), the
query plan operates as it should in this scenario - evaluating the
constraint to include tables in the query plan.

 
 
 

1. Change table check constraint to column check constraint?

After our SQL 6.5 database was wiz'd into SQL 7.0 format, I noticed that many
(but not all) of the column check constraints were converted to table check
constraints.  These really are simple data-entry checks, and logically belong
with the column.

Is there a way to convert them back to column check constraints without
having to recreate the table?  I can't find any syntax in ALTER TABLE to add
a column check constraint.

Why do I care?  It's either change the ERWin schema or fix the database, and
frankly, I think ERWin is right this time.

TIA
--
Bobb Head

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Row level locking

3. Column check constraint vs table check constraint

4. Is there a public domain SQL syste?

5. Table constraints and Column constraints

6. System DSN

7. Table constraints vs column constraints

8. Detect Record Changes in a form

9. Table level column reference problem in Check constraint

10. Table & Column level constraints

11. how can i change my table/column constraint

12. Column-level constraints on updating

13. SQL7 Column-level constraints/filters possible?