SQL 2000 server: I want to standardize my naming scheme. I have views that
have other views dependent on them. I would like to rename some of these
without breaking the dependent views. It appears that sp_rename doesn't do
the trick.
Also, I'm confused about this comment in BOL: "Important After renaming
stored procedures and views, flush the procedure cache to ensure all
dependent stored procedures and views are recompiled."
I ran some tests, and it looks like sp_rename doesn't fix dependent views
that use a view that gets renamed, so what is this comment about?
Thanks. Any comments and suggestions will be appreciated.
David WalkerDavid
No, sp_rename does not go through all the dependent procedures, views and triggers and change the old view name to the new view name. You need to do that yourself. If you are relying on the info in sysdepends, DO NOT. You can create a parent stored procedure that references a child/sub procedure before the child is created. SQL will yell at you, but it will do it. You can create the child next and all will be fine
You can search for objects that reference your old view name with
SELECT OBJECT_NAME(id) FROM syscomments WHERE text LIKE '%oldviewname%
in every database that may reference the old view
The procedure cache is an area of the SQL Server memory that hold the execution plans of stored procedures and views. You can just try your changes after you implement them to see if it works, which you probably should. If some erro occurs run DBCC FREEPROCCACHE
Norman
No comments:
Post a Comment