Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    30

    Unhappy Unanswered: Dropping Table,Index,Constraints

    HI ALL

    I HAVE 150 TABLES WITH CORESPONDING INDICES AND PRIMARY /FOREIGN KEY DEFINED FOR THE TABLES IN MY DATABASE

    HOW CAN I DROP THE TABLES ALONG WITH THE INDEX,PRIMARY AND FOREIGN KEY CONSTRAINTS. ?

    IS THERE A WAY TO GET INFORMATIO FROM THE SYS-TABLES AND PERFORM THIS ACTION ?

    IF I DO MANUALLY IT WILL TAKE DAYS TO DROP 150 TABLES.
    SO PLEASE HELP.

    THANKS
    BOLLIN

  2. #2
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443

    Re: Dropping Table,Index,Constraints

    Originally posted by bollin99
    HI ALL

    I HAVE 150 TABLES WITH CORESPONDING INDICES AND PRIMARY /FOREIGN KEY DEFINED FOR THE TABLES IN MY DATABASE

    HOW CAN I DROP THE TABLES ALONG WITH THE INDEX,PRIMARY AND FOREIGN KEY CONSTRAINTS. ?

    IS THERE A WAY TO GET INFORMATIO FROM THE SYS-TABLES AND PERFORM THIS ACTION ?

    IF I DO MANUALLY IT WILL TAKE DAYS TO DROP 150 TABLES.
    SO PLEASE HELP.

    THANKS
    BOLLIN
    Hi Bollin,

    I think this should work if you dont have any tables with inter-dependent keys.

    Have the drop table commands in a single SQL file. Keep running them a few times.

    Lets say Table1 has a foreign key of Table2

    And the drop table order is

    drop table Table2
    go
    drop table Table1
    go

    The first time you run the SQL Table2 drop command will fail, but Table1 will be dropped. The second time you run the SQL Table2 will be dropped as there is no Table1 anymore.

    BTW, All associated indexes and keys will be automatically dropped.

    Hope this helps.

    Thanks,
    Vishi.

  3. #3
    Join Date
    Sep 2002
    Posts
    30

    Thank You

    thanks trvishi

Posting Permissions

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