I've created local copies of a related set of databases by restoring the backup of one set from another server under different names.
So I have taken bak files of databases named ABCMain and ABCDependent from another server and have restored them as XYZMain and XYZDependent on my local SQL Server instance.
Unfortunately, all the view definitions in the ___Dependendent DB have hard-coded database qualifiers pointing back to ABCMain like this:
CREATE VIEW dbo.[MyView] AS SELECT * FROM [ABCMain].dbo.MyTable
I need to drop "[ABCMain]" or change it to "[XYZMain]" in over 1000 views in XYZDependent. SQL Server doesn't allow altering system catalogs.
Any ideas?
Thanks,
John