Results 1 to 11 of 11

Thread: Change a table name

  1. #1
    Join Date
    May 2003
    Posts
    9

    Change a table name

    How do you change a table name, say from APPLES to PEARS ?

    Many thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    create table apples(id int)
    sp_rename apples,pineapple

  3. #3
    Join Date
    May 2003
    Posts
    9
    Cheers MAK for your reply, but I can't get that to work. I've got the table APPLES already setup but I can't change the name of the table.

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    why not? what error message you are getting?

    do u have dbo access or db_ddladmin access?


    BTW.. r u using sql server 2000?

  5. #5
    Join Date
    May 2003
    Posts
    9
    I'm new to this, I'm using Oracle SQL Plus

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  7. #7
    Join Date
    Mar 2003
    Posts
    468
    for Oracle you can rename a table by:
    ALTER TABLE table_name2 RENAME TO table_name1;

  8. #8
    Join Date
    May 2003
    Posts
    9
    Many thanks! excellent. Can you change a column name in Oracle do you know ?

  9. #9
    Join Date
    Mar 2003
    Posts
    468
    yes,
    example:
    ALTER TABLE table_name
    RENAME COLUMN column_name1 TO column_name2;

  10. #10
    Join Date
    May 2003
    Posts
    9
    I'm afraid I can't get this to work in Oracle any ideas ?

    Cheers

    Rich

  11. #11
    Join Date
    Mar 2003
    Posts
    468
    more than likely version / permissions.
    what error are you getting.
    what version or oracle are you using.

Posting Permissions

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