473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Disabling Constraints in a table

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

May 30 '06 #1
3 19602
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....9505d267f6f3e5

Regards,

Mehmet Baserdem

May 30 '06 #2
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
Mehmet Baserdem wrote:
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....9505d267f6f3e5

Regards,

Mehmet Baserdem


May 31 '06 #3
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

May 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ghulam Farid | last post by:
Hi i have a table with primary key defined on col1 and col2. now i want to have col3 also included in primary key. when i alter the table it gives me error for duplicate rows. there is an option...
0
by: Sharon Cowling | last post by:
Hi, my problem is this: I have a table called faps_key the unique identifier being key_code: taupo=# \d faps_key Table "faps_key" Column | Type | Modifiers...
4
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
5
by: Benny Raymond | last post by:
I currently have a relation set up between two tables in my dataset. Sometimes I'd like to set the value in the Foreign Key Field to NULL (if it doesn't refrence the other table at all). ...
3
by: David Parker | last post by:
I would like to be able to truncate all of the tables in a schema without worrying about FK constraints. I tried issuing a "SET CONSTRAINTS ALL DEFERRED" before truncating, but I still get constraint...
4
by: pankaj_wolfhunter | last post by:
Greetings, I want to bulk load data into user defined SQL Server tables. For this i want to disable all the constraints on all the user defined tables. I got solution in one of the thread and did...
3
by: Jeff Kish | last post by:
Hi. I'm getting errors like this when I try to run an upgrade script I'm trying to write/test: altering labels to length 60 Server: Msg 5074, Level 16, State 4, Line 5 The object...
1
by: cvijaykrishna | last post by:
hi i have so many checkboxes inside a table can i disable all the checkboxes at once by disabling the table or is there any alternative (i have to use javascript becoz i need to do it in client...
1
by: gentsquash | last post by:
With a JS dynamically created table elt = document.createElement("table"); // Statements filling in the table. document.body.appendChild(elt); I'd like to do the equivalent of ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.