Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Script to set multiple DBs to read write

Author  Topic 

Jons
Starting Member

1 Post

Posted - 2009-07-09 : 08:36:40
I am new to SQL. Is it possile to script the process of setting multiple DBs to read write then back to read only? All of the DBs are named pgsnapshotyyyymmdd. The yyyymmdd are only business days.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-09 : 10:39:53
set your output to text, execute this, copy the results

select 'ALTER DATABASE [' + name + '] SET READ_WRITE;' + char(10) + 'GO' from sys.databases where name like 'pgsnapshot________'
Go to Top of Page
   

- Advertisement -