Re: Rename a view that has dependent views
From: Sebastian K. Zaklada (szaklada-dont-like-spam_at_skilledsoftware.com)
Date: 02/10/04
- Next message: Jasper Smith: "Re: Invalid Class String error"
- Previous message: David Walker: "Rename a view that has dependent views"
- In reply to: David Walker: "Rename a view that has dependent views"
- Next in thread: David Walker: "Re: Rename a view that has dependent views"
- Reply: David Walker: "Re: Rename a view that has dependent views"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 18:45:20 +0100
> 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.
1) Renaming a view does not change the name of the view in the text of the
view's definition. To change the name of the view in the definition, modify
the view directly. sp_rename will simply alter the name of object in the
sysobjects system table, but will not alter its text in the syscomments
table.
2) If you have views like VTest1, VTest2 and VTest2 uses VTest1 in the
SELECT clause, the sp_rename will not change the SELECT code in the VTest1.
The same is true for other dependencies (UDFs, triggers...)
3) My advice is:
- script the view and all dependent objects with re-create statements
- perform a global search-and-replace to change the old view name to new
view name
- double check that it replaced only what you intended to replace
- run the script (it will re-create the view and all dependent objects)
sincerely,
-- Sebastian K. Zaklada Skilled Software http://www.skilledsoftware.com This posting is provided "AS IS" with no warranties, and confers no rights.
- Next message: Jasper Smith: "Re: Invalid Class String error"
- Previous message: David Walker: "Rename a view that has dependent views"
- In reply to: David Walker: "Rename a view that has dependent views"
- Next in thread: David Walker: "Re: Rename a view that has dependent views"
- Reply: David Walker: "Re: Rename a view that has dependent views"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|