SQL Server Performance

how can I change a table name?

Discussion in 'Getting Started' started by sam_summer, May 31, 2007.

  1. sam_summer New Member

    Wonder what is the command to change a table name from Staff to Employee? thanks.
  2. Luis Martin Moderator

    That table has FK?


    Luis Martin
    Moderator
    SQL-Server-Performance.com

    All in Love is Fair
    Stevie Wonder


    All postings are provided “AS IS” with no warranties for accuracy.



  3. sam_summer New Member

  4. MohammedU New Member

    sp_rename procedure...

    This example renames the customers table to custs.
    EXEC sp_rename 'customers', 'custs'




    MohammedU.
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  5. sam_summer New Member

    Thanks so much! It worked. It's my first experience on the site and I really enjoyed it.
  6. MohammedU New Member

    Good...<br />Welcome to the SQL community...and enjoy the rid [<img src='/community/emoticons/emotion-5.gif' alt=';)' />]<br /><br />MohammedU.<br />Moderator<br />SQL-Server-Performance.com<br /><br />All postings are provided “AS IS” with no warranties for accuracy.<br />
  7. satya Moderator

    Just to add on:
    After renaming tables, stored procedures and views, flush the procedure cache to ensure all dependent stored procedures and views are recompiled.

    Welcome to the forum!

    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
  8. dineshasanka Moderator

    if you are using sql server 2005, right click the table and select option named rename

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

    Visit my Blog at
    http://dineshasanka.spaces.live.com/
  9. lokesh546 New Member

    thanks. its gud to use.
  10. Madhivanan Moderator

    quote:Originally posted by lokesh546

    thanks. its gud to use.
    What is good to use?

    Madhivanan

    Failing to plan is Planning to fail

Share This Page