I have found stored procedures that have broken references between sys.sysobjects and sys.modules. The object_id and object_name do not seem to match up on about 180 stored procedures in the database. I have checked for different schemas but that is not the case. Using a dbForge tool I was able to determine that all of these had an "invalid object name" reference (usually a table that does not exist.) My concern is that we will not be able to remove these since they are not consistent in the system views/tables.
I am not sure this rambling question makes any sense but, if you understand the issue I would appreciate any assistance you can provide.
Answer by Solo ·
You can use one of the following:
To delete a procedure in Object Explorer
To delete a procedure in Query Editor
SELECT name AS procedure_name ,SCHEMA_NAME(schema_id) AS schema_name ,type_desc ,create_date ,modify_date FROM sys.procedures;
; GO " style="line-height: 19px; -webkit-font-smoothing: auto; font-family: monospace, monospace; font-size: 0.875rem; direction: ltr; border-radius: 2px; display: block; background-color: var(--body-background-medium); box-sizing: inherit;">DROP PROCEDURE <stored procedure name>; GO