Errors are inevitable during development. To correct errors and normalize them. You can use the system stored procedures sp_rename and OBJECTPROPERTY of MSSQLServer to change the rename.
Errors are inevitable during development. To correct errors and normalize them. You can use the system stored procedures sp_rename and OBJECTPROPERTY of ms SQL Server to change the rename.
For more information about OBJECTPROPERTY, see:
Errors are inevitable during development. To correct errors and normalize them. You can use the system stored procedures sp_rename and OBJECTPROPERTY of ms SQL Server to change the rename.
Instance 1: Change the table name:
The Code is as follows:
If exists (select top 1 FROM dbo. sysobjects WHERE id = object_id (n' [dbo]. [Employee] ')
And objectproperty (id, N 'isusertable') = 1
)
EXECUTE sp_rename 'employe', 'member'
Instance 2: Change the field name:
The Code is as follows:
EXECUTE sp_rename 'member. [EmployeeName] ', 'name', 'column'
Instance 3: Change the primary key:
The Code is as follows:
If exists (select top 1 FROM sysobjects WHERE id = OBJECT_ID (n' [PK _ Employee _ B00879C509746778] ')
And objectproperty (id, n'isprimarykey') = 1)
EXECUTE sp_rename 'pk _ Employee _ B00879C509746778 ', 'pk _ Member', 'object'
Instance 4: Change the stored procedure name:
The Code is as follows:
If exists (select top 1 1 FROM sysobjects WHERE id = OBJECT_ID (N '[usp_Employee_Import]')
And objectproperty (id, n' IsProcedure ') = 1)
EXECUTE sp_rename 'usp _ Employee_Import ', 'memberinss'
After successful execution, you will receive a message:
Caution: Changing any part of an object name cocould break scripts and stored procedures.