All mentioned variables was declared and initialized. Note: sources given below are code from the procedure.
I have found few examples, however, those does not answer my question. Use sys.sql_expression_dependencies to list dependencies on the object before renaming it. I am trying to insert a few values into a table using EXECUTE statement. For example, if you rename a table column and that column is referenced in a trigger, you must modify the trigger to reflect the new column name. You must modify any objects that reference the renamed object manually. Renaming an object such as a table or column will not automatically rename references to that object. Given below is the solution that will search a string value in all columns in the table and in all tables in a database.
Yesterday, I received an inquiry from ‘Abhilash’ one of my blog readers, how to search a string value in all columns in the table and in all tables in a database. Instead, drop and re-create the object with its new name. I really appreciate active participation of my blog readers. Therefore, we recommend that sp_rename not be used to rename these object types. In this example, we are using the SPDEPENDS stored procedure. Method 1 to find Table Dependencies in SQL Server. You can use also use the query to find Table Dependencies. Use Query to find the Dependencies of a Table in SQL Server. Renaming a stored procedure, function, view, or trigger will not change the name of the corresponding object either in the definition column of the sys.sql_modules catalog view or obtained using the OBJECT_DEFINITION built-in function. The following are the list of dependencies on the Employee table.
To rename a user-defined stored procedure using sp_rename,you can do something like this and it literally works USE AdventureWorks2012 ĮXEC sp_rename '', 'TerrID', 'COLUMN' Using sp_rename will look something like this. The third parameter( is required when you want to rename aĭatabase object other than a stored procedure.