I need to put a database into single-user mode so I can run DBCC CHECKDB with repairs.
This database is a distributor for replication.
How can I do this?
Thanks for the response.
I don't think I was totally clear in my initial request. When I try putting the database in 'single user' mode, I receive an error message stating the option can't be changed while another user is in the database.
I'm pretty sure there is no one else in this database, but I have it set up for replication with another server. Is this why I am getting the error message?
I looked at the article on sysdatabases, and it seems I can change the 'status' field to 4096 to make the database 'single user'. This field currently has a value of 12. Any idea what this means?
James -
Thanks for the code.
I am trying to use your code for single user mode, and am getting the following error: Incorrect syntax near the keyword 'SET'. Any ideas?
I am using SQL7.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.