I used the following the script to attach a database. But the database created is read only.
What modifications should I make in the script to make it read-write. Please help me.
USE [master]
GO
CREATE DATABASE [GemDatabase] ON
( FILENAME = N'E:Program Files (x86)ICE ProductsICEConnect200New DatabaseGemDatabase.mdf' ),
( FILENAME = N'E:Program Files (x86)ICE ProductsICEConnect200New DatabaseGemDatabase_log.ldf' )
FOR ATTACH
GO
if not exists (select name from master.sys.databases sd where name = N'GemDatabase' and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [GemDatabase].dbo.sp_changedbowner @loginame=N'sa', @map=false
GO
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…