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 > about creat a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-04-07, 19:59
yanqinghuang yanqinghuang is offline
Registered User
 
Join Date: Oct 2007
Posts: 23
about creat a table

Hi,my questions is :
CREATE TABLE dwaine.mytab (col1 INT, col2 INT)
INSERT INTO dwaine.mytab VALUES (1,2)
INSERT INTO dwaine.mytab VALUES (4,3)
ROLLBACK
The table created or not ? i know insert will rollback but i am not very clear that the table created ?
thanks
Reply With Quote
  #2 (permalink)  
Old 11-05-07, 03:24
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
the CREATE TABLE is rollbacked, too.
Reply With Quote
  #3 (permalink)  
Old 11-05-07, 08:39
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
And the reason is that the CREATE TABLE statement is - like any other SQL statement - executed in a transaction. Thus, if you roll back the transaction, the create table must be undone as well.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 11-08-07, 01:09
yanqinghuang yanqinghuang is offline
Registered User
 
Join Date: Oct 2007
Posts: 23
If the statements is :
CREATE TABLE dwaine.mytab (col1 INT, col2 INT)
INSERT INTO dwaine.mytab VALUES (1,2)
INSERT INTO dwaine.mytab VALUES (4,3)
ROLLBACK
COMMIT
The table created or not ?
Thanks !
Reply With Quote
  #5 (permalink)  
Old 11-08-07, 01:47
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
The table does no longer exist after the ROLLBACK.
the following COMMIT has no effects in your scenario.
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