My database has about 30 views, most of which have a reference to another database on this server (call it DB1
).
Now, without going into the reasons why, I need to update all those views to DB2
, also on the local server.
I would hate to have to do this manually on each view. Is there some SQL query I can run that will replace all occurrences of the string 'DB1' with 'DB2' in all my views?