Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2006

Tip: Looking for answers? Try searching our database.

Disabling Constraints in a table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
santhoshb99@gmail.com - 30 May 2006 19:44 GMT
Hi,
I am using IBM DB2 UDB 8.2.
I have a scenario where in I need to disable the constraints of a given
table temporarily.

For ex:
I need to delete records in all tables irrespective of existing foreign
keys and other dependencies. Inorder to do that I will need to disable
all the constraints. How do I go about doing that.
Is there only one option of droping the constraints which means that
the constraints have to be recreated again?

Please suggest.
Thanks in advance,
Santhosh B
Mehmet Baserdem - 30 May 2006 20:44 GMT
Santosh,

You can use   "set integrity for  your_table_name  off "

But be careful & gentle.  Your table will be in check pending state for
a while.

Please  refer to:
http://groups.google.com/group/comp.databases.ibm-db2/browse_thread/thread/b3bc2
94adeba7d28/099505d267f6f3e5?q=Constraints&rnum=3#099505d267f6f3e5


Regards,

Mehmet Baserdem
santhoshb99@gmail.com - 31 May 2006 09:33 GMT
Mehmet,
I am sorry if I am asking you a basic question.

I feel I am doing it the same way as you mentioned in the topic.
The following is the query:

SET INTEGRITY FOR TEST.EMP OFF!
SET INTEGRITY FOR TEST.EMP FOREIGN KEY IMMEDIATE UNCHECKED!
DELETE FROM TEST.EMP WHERE EMPID=1!
SET INTEGRITY FOR TEST.EMP IMMEDIATE CHECKED!

Here, The EMP table has been referrenced in few other child tables.

Please suggest if there is any thing wrong in the above statements.
If anybody else could give me a suggestion, it would be of great help.

Thanks in advance,
Santhosh

> Santosh,
>
[quoted text clipped - 9 lines]
>
> Mehmet Baserdem
Mehmet Baserdem - 31 May 2006 20:19 GMT
Santosh,

I noticed that I overlooked the posting link I sent to you. When I
checked it again I noticed that even "SET INTEGRITY ..."  statements
will not be helpful for you.

Looks like the only option is dropping & recreating constraints as you
mentioned in your first post.

Regards,

Mehmet Baserdem
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.