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 > drop all sequences

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-14-10, 03:52
db2cap db2cap is offline
Registered User
 
Join Date: May 2010
Posts: 87
drop all sequences

Hi,
How do i drop all sequences in a schema in db2? Dropping it one by one is very difficult as there are huge number of sequences.
Reply With Quote
  #2 (permalink)  
Old 09-14-10, 06:17
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
try this

db2 -x "select 'drop sequence '||SEQSCHEMA||'.'||SEQNAME||';' from syscat.sequences where seqschema = 'schemaname' " > drop_seq.sql

this will create script for you on drop_seq.sql after this

db2 -tvf drop_seq.sql -z drop_seq.out

will drop all the seq on tht schema



regds
paul
Reply With Quote
  #3 (permalink)  
Old 09-14-10, 08:51
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by Mathew_paul View Post
try this

db2 -x "select 'drop sequence '||SEQSCHEMA||'.'||SEQNAME||';' from syscat.sequences where seqschema = 'schemaname' " > drop_seq.sql
You may want to use RTRIM() around the schema name, otherwise you'll end up with a statement like this:
Code:
drop sequence MYSCHEMA                                                    .MYNAME...
Reply With Quote
  #4 (permalink)  
Old 09-15-10, 03:38
db2cap db2cap is offline
Registered User
 
Join Date: May 2010
Posts: 87
Thanks for your reply
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