Rename objects

  • Comments posted to this topic are about the item Rename objects

  • Hi,

    Maybe i am declaring myself as foolish, but what is the big difference between renaming an object and dropping and re-creating it with a different name (except that the later will let you lose all the object's information as well)?

    Best regards,

    Dietmar.

    Best regards,
    Dietmar Weickert.

  • Reference: sys.objects: (BOL)

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/f8d6163a-2474-410c-a794-997639f31b3b.htm[/url

    O.K. someone explain to me where I went wrong. From sys.objects, type column appears:

    type char(2) Object type:

    . . . . . .. . . . .V = View

    So is a View an object or isn't it?

    Further from BOL How to: Rename Views

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/5eed0488-81d2-40e8-8fdf-b0a640a591d0.htm

    The name of a view cannot be changed but, rather, a new view must be created with the desired new name and the old view definition copied into the new view.

    Bold face added to highlight what I believe makes the answer qiven as the correct answer actually incorect.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Dropping and recreating should give it a new ID, as well as change the versioning. IF there is substantial data in the object, that can take time.

    Renaming just changes the meta data, and while there are restrictions, it is possible.

  • Edited after post by

    beezell

    If you create a view and use the sp_rename stored proc you can rename it. This might be an error in BOL.

    Must be so, did it and you are correct it did rename the view.

    My apologies to Steve Jones and to VM the author of the QOD

    My lame argument that the answer was not correct as given has been removed ... since my argument was NOT correct, and I stand corrected.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • If you create a view and use the sp_rename stored proc you can rename it. This might be an error in BOL.

    Cheers,

    Brian

  • One 'gotcha' is that if you rename a stored procedure, the code returned by sp_helptext will still have the original name 🙂

  • wow what about sys objects! in the question doesn't mention about user or system objects so for that reason the question include also the system objects - and sure that you can not rename the system objects!

    :-P:-P:-P

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • While some of us got the answer right, the "right" answer was a little misleading. You actually (obviously) cannot rename system objects. So, technically, not ALL objects can be renamed. :hehe:

    Kindest Regards,Rick Farris

  • You also cannot rename symmetric keys. Just fought that battle.

Viewing 10 posts - 1 through 9 (of 9 total)

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