Trying to rename a database, but ran into the error noted below
exec sp_renamedb [TSD08282017], 'REDWOOD_TSD_PC31'
Msg 902, Level 16, State 1, Line 5 To change the NAME, the database must be in state in which a checkpoint can be executed.
Get Database State
declare @database sysname set @database = 'TSD08282017' select tblSD.[name] , tblSD.[is_read_only] from sys.databases tblSD where tblSD.[name] = @database
Database came back as readonly
Change Database State
alter database [TSD08282017] set READ_WRITE with rollback immediate