Results 1 to 4 of 4
  1. #1
    Join Date
    May 2010
    Posts
    88

    Unanswered: 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.

  2. #2
    Join Date
    Oct 2007
    Posts
    246
    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

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    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...

  4. #4
    Join Date
    May 2010
    Posts
    88
    Thanks for your reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •