How to do bulk update of views?
Posted
by Shaul
on Stack Overflow
See other posts from Stack Overflow
or by Shaul
Published on 2010-06-06T10:27:01Z
Indexed on
2010/06/06
10:32 UTC
Read the original article
Hit count: 162
sql-server-2008
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?
© Stack Overflow or respective owner