question

savanimd avatar image
savanimd asked

sys.objects [name] column is not consistent with object name in definition (stored procedure name)

Last week, as a part of one requirement, I wrote a script to generate object definition for all database objects. While testing, I found that for few stored procedures, [sys.objects].name was not matching with name in actual object definition (as returned by OBJECT_DEFINITION(Object_ID)). It was very strange and I saw it first time in life. While thinking for what could be the reason of same, I found that it happens when we rename stored procedure from Object Explorer (View--> Object Explorer in SQL Server Management studio). Just wondering, is there any way to retrieve actual object name (in this case, SP name)?
sqlobject-names
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

seanlange avatar image seanlange commented ·
This has been discussed and "rediscovered" many times over the years. This happens when you rename procedures, functions, views etc... Here is one article discussing this. http://blog.sqlauthority.com/2008/09/28/sql-server-renaming-stored-procedure-does-not-update-sysprocedures/
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.