When migrating a database from SQL Server 2000 to SQL Server 2005, it became clear that the line
RAISERROR ('test error %S', 16, 1, @test)
due to wrong written %S instead of %s SQL Server 2000 simply works wrong (returns only the first character of the parameter), but SQL Server 2005 does not create a procedure:
Msg 2787, Level 16, State 1, Line 6
Invalid format specification: ‘%S’.
Because such writing could occur in any procedure, we can find them all::
SELECT name FROM sys.procedures WHERE CHARINDEX ( '%S', OBJECT_DEFINITION(object_id) COLLATE Latin1_General_CS_AS) >0