I need to find a way to determine what object in a database has the original database name hardcoded into it. I've restored a copy of a database under a different name and run homegrown scripts to make all the naming adjustments. Let's say the original DB was named ABC_Db and the restored copy has been renamed to XYZ_Db. When I attempt to perform an UPDATE on CoreTable, I get
Invalid object name 'ABC_Db.dbo.CoreTable'
I've queried against the syscomments and done various manual checks against relations and indexes, etc. with no luck. What's next?
Thanks,
John
To find it
SELECT
OBJECT_NAME(object_id)
FROM
sys.sql_modules
WHERE
definition LIKE '%ABC_Db%'
syscomments is unreliable for long code.
sys.sql_modules covers all code and is safe for all objects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With