Thanks,
Thanks for your kind reply.
But i asked without dropping those objects.
If we use sp_rename means, it'll not affect the syscomments table..
For that only i mentioned it "issue".
Sivakumar Rangasamy wrote:
If we use sp_rename means, it'll not affect the syscomments table..
Are you referring to the text column in sys.syscomments? By design, the name of the object will not get updated in the text column if it is renamed because the text column returns the actual, original text of the SQL definition statement. The text (and name of the object) will only get updated if you drop and then recreate the object. This is the same behavior as the definition column of the sys.sql_modules catalog view.
Fine.
If we want to change the original text means, drop and recreate the object or else alter that particular object.
Here my question is if we use sp_rename sp means, the object name only renamed.
What about dependency things (like object’s text)?
Is it valid?
1. By id (FK constraint, schema binding reference, index to table, table to trigger, view to base tables etc)
2. By name (SP reference (non-schema bound), function reference (non-schema bound), 3/4-part names etc). This type of non-schema bound reference is also tracked loosely by SQL Server and not enforced.
Now, when you use sp_rename we only change the name of the entity (table, view, module, constraint etc) in the metadata. We do not change the text that provides the definition for the object. This is because for compilation purposes like SPs or functions or triggers, the name in the text doesn't matter and it is just part of valid syntax for the CREATE PROCEDURE/FUNCTION/TRIGGER statement. The name is stored separately from the actual definition of the object and that is what gets used. The name in the definition is parsed at create time and that is pretty much it.
So when you modify the name of a SP you will have to go and fix the other modules that reference it. SQL Server cannot do this by itself because there is logical dependency that will be too expensive to evaluate and modify. And in cases where dynamic SQL is used it is not possible at all due to the runtime nature and control of flow logic or unknown values of variables.
SQL Server 2008 however has new object dependency reporting features that will help you identify most of the references easily. Start with the following topic in the new BOL:
http://msdn2.microsoft.com/en-us/library/bb677168(SQL.100).aspx
Understanding dependencies topic:
http://msdn2.microsoft.com/en-us/library/ms345449(SQL.100).aspx
Umachandar Jayachandran - MS wrote:
I am not sure about your question. Are you asking if there is a DDL instead of system SP to rename an object? If so, there is none. Renaming an object is a special operation and each RDBMS has its own way of doing it. The ANSI SQL standards only has ALTER DDL to change objects or object definition. So this is a special operation and proprietary to the implementation of the database engine.
Here my query is, Not only DDL statements.
In sp_rename sp, “DBCC RENAMECOLUMN” is used for renaming a column.
Here renaming a column process is also have numerous of dependancies.
Like that am asking……
In sp_rename stored procedure, “dbcc renamecolumn” Command used to rename a column. (The column in table can also have a so many dependencies).
For that only I’m asked, “Is it feasible, to renaming object(stored procedure) through a command?”.