Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    63

    Unanswered: changing the schema of table

    Is there any way to change the schema name of a table or do I have to drop and recreate the table with new schema name?

    Thanks,
    toby

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Toby,
    No, no direct and simple way. The best way would be to:

    1) create new table (CREATE TABLE NewSchema.MyTable like OldSchema.MyTable)
    2) copy data (INSERT INTO NewSchema.MyTable select * from OldSchema.MyTable)
    3) Create any indexes on new table
    4) drop old table.
    5) fix all references to OldSchame.MyTable to NewSchema.MyTable

    HTH

    Andy

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    ...... or just create an alias for the table with the new schema

    create alias newalias.tablename for oldalias.tablename

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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