Refactor table to view

neilxneilx Posts: 14
edited July 24, 2009 7:07AM in SQL Refactor Previous Versions
If I want to rename a table and use a view in its place to prevent applications from breaking, how can I do this?

If I use smart rename, then absolutely everywhere the table is mentioned is changed. Could I limit the changes to tables only (e.g. relationships and triggers) and then create a view with the original name of the table?

Would I be better off scripting the database, creating the view in the script then renaming the table name occurences mainually so I can choose only the occurences I want?

Comments

  • Anu DAnu D Posts: 876 Silver 3
    Thanks for your post.

    Yes you can follow the below mentioned steps:

    1. Rename the table with view.
    2. Follow the <Smart Rename> wizard and SQL Refactor will generate the script for the rename of that object.
    3. You can than manually remove the queries where you do not want the object rename to be executed.

    Kindly let us know if that helped.
    Anuradha Deshpande
    Product Support
    Redgate Software Ltd.
    E-mail: support@red-gate.com
Sign In or Register to comment.