Problem in rename the views

  • Hai,

    I have a view called "Vw_Sample"

    Now. I renamed it to "Sample"

    After that i put Sp_Helptext Sample and executed.

    It's Return with old view name "Vw_Sample"

    like

    Create View Vw_Sample as

    Select SupplierId,SupplierName From Supplier

     

     

     

     

     

  • When you rename any object that has code associated to it, the only change made is its name in sysobjects. The script has to be updated as well manually.

  • sp_rename is a procedure that I think should only be used for tables and the child objects of tables where the object doesn't have any entries in the syscomments table which is where things can get out of whack.

    Everything else should be dropped and re-created with the new name. You'll then always have the correct data matched in syscomments to the object.

    This is one of those things where I believe Microsoft could have done a little more to help.

     

     

    regards,

    Mark Baekdal

    http://www.dbghost.com

    http://www.innovartis.co.uk

    +44 (0)208 241 1762

    Build, Comparison and Synchronization from Source Control = Database change management for SQL Server

     

     

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply