If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > constraints and transactions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-06, 10:29
nelapsi nelapsi is offline
Registered User
 
Join Date: Dec 2004
Posts: 43
constraints and transactions

that I want to do :
Code:
update command options using c off;
create table ttt(id integer not null);
commit;
insert into ttt values(null)
<....>
update ttt set id = 1;
commit
but DB2 check "not null" constraint inside transaction. But I want to check it after transaction..
how can I do it?
Reply With Quote
  #2 (permalink)  
Old 02-16-06, 10:46
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Create the table without the unique constraint; add the constraint when you're finished with updates.
Reply With Quote
  #3 (permalink)  
Old 02-16-06, 16:32
nelapsi nelapsi is offline
Registered User
 
Join Date: Dec 2004
Posts: 43
Quote:
Originally Posted by n_i
Create the table without the unique constraint; add the constraint when you're finished with updates.
I want to use such transactions at any time - not only after table creation
Reply With Quote
  #4 (permalink)  
Old 02-17-06, 07:10
NGambler NGambler is offline
Registered User
 
Join Date: Jul 2005
Posts: 25
You can switch a constraint to enforced or not enforced state...
for instance:

update command options using c off;
create table ttt
(id integer
constraint chk_null CHECK(id is not null)
);
commit;
alter table ttt alter CHECK chk_null not enforced;
insert into ttt values(null);
<....>
update ttt set id = 1;
alter table ttt alter CHECK chk_null enforced;
commit;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On