sql - How do I find Stored Procedures with wrong text in syscomments -
appears in many stored procedures that were replaced with the name of sp_rename, leaving syscomments instead of the old proc name Can be new PR name.
Thus, my DB transfers have failed to move correctly.
Is there any way of launching a launch (or an object) to find out names outside of singular?
Or better, an easy way to find and fix them?
you can
from object_name (id) to system Select WHERE COLID = 1 and OBJECTPROPERTY (id, 'isprocedure') = 1 and reflex (copy (text, CHAR (13), ''), CHAR (10), '') Like '%% PROC%' + Item_Name (+) + '%' and (Repeat (Copy (Text, Cher (13), ''), Cher (10), ''% CREATE% PROC% '+ Object_m +']% ').
SYS.SQL_MODULES
Probably can be a bit stronger, in which you have a comment of 4,000 characters B. Efore the PROC
b .
There is a more robust solution to parse the text, however, a script will be generated to run to restore all your stored procedures.
SELECT 'EXEC sp_refreshsqlmodule' '+ Boat (schema_nm) (' schema_id) + '.' + Coatime (object_name (object_id)) + '' '' from proof syms program
... then copy and paste the result and paste it into the management studio quo Paste in the window and execute the resulting script, give you an error for those people where names are out of time
This will be due to compiling all of your stored procedure, so that any such product Do not do this on server if this is a problem.
Edit to provide additional information about the bug.
The code should not be used in the aforementioned answer, if there is any possibility that sp_rename
has been used to swap the definition of two objects sp_refreshsqlmodule < / Code>
Comments
Post a Comment