Hello, I have some views in my database that point to another database on the same server. Views also have certain grants for the users/roles I would like to copy database to another server(environment) and I need to redirect views to the appropriate database on the server. What is the easy way to accomplish it dynamically? I don't want to update syscomments. (It's 2000) and also how can it be done, that I can convert it easy to 2005-2008. example: On my Prod server I have
create view dbo.V_Country select Country, Name, Code from PROD_MAIN..Country go grant select on V_Country to Role_1 go grant select on V_Country to Role_2 go grant select on V_Country to User_1 go
When I restore database on DEV server I would like it to generate the following automatically.
alter view dbo.V_Country select Country, Name, Code from DEV_MAIN_23..Country go
I would like to pass as parameter 'PROD_MAIN' ,'DEV_MAIN_23' , because they might change Also my views can be big.
Thank you in advance