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
 Old Forums
 CLOSED - General SQL Server
 How can i lock database in SQL Server 2000

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-19 : 07:41:57
Md. Shafiuzzaman writes "How can I lock a database in SQL Server 2000?"

Kristen
Test

22859 Posts

Posted - 2006-09-19 : 08:13:11
What do you want to lock it for? If you want to prevent users accessing it whilst you perform a new version roll-out then:

ALTER DATABASE MyDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

or possibly

ALTER DATABASE MyDatabaseName SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

if the application is not logging on as SA - which is a VERY bad idea anyway!

If you just want to lock the database whilst you update a few records then there are better ways of solving that particular problem

Kristen
Go to Top of Page
   

- Advertisement -