SQL - Structured Query Language |
RENAME ViewSQL Server occur error while rename existed view, when the view include with other view, queries, stored procedures, user-defined functions and any application. To avoid error, close and open particular user defined database and then rename the view object or else change the database property into single user mode and then rename the view object, after rename the view object, once again change the database property into multi user mode. Renaming a stored procedure, view or trigger object will not change the name of the corresponding object name in the syscomments table. This may result in problems generating a script for the object as the old name will be inserted from the syscomments table into to CREATE statement. To avoid this error, do not rename these object types, instead, drop and re-create the object by its new name. The following query is used to rename existed view object -- Example 56 --
USE EBusiness GO
EXEC sp_rename 'EmpDept','EmployeeDepartment' GO
SELECT * FROM EmployeeDepartment Query Output Screen |
* * * * *