August 13, 2003 at 2:51 am
I try to use sp_dboption to set single _user in SQL 7 but can't, due to the fact that an application keeps getting back to the db when I kill the process. What should I do?
Please HELP... Thank you!
August 13, 2003 at 2:58 am
hi, can you temporarily remove the logins permissions in the database in question ?
or change the default database to another one ? this may make the connection fail, so you can change the option. However don't forget to undo the changes after you've finished
Paul.
August 13, 2003 at 4:46 pm
I usually try something like this "kill & set" in an attempt to get the single_user option in before the other user/app does:
use master
declare @kill varchar (8000)
select @kill = ISNULL(@kill , '') + ' kill ' + cast(spid as varchar)
from sysprocesses where dbid = db_id('pubs')
print @kill
exec (@kill)
exec sp_dboption 'pubs', 'single', true
Cheers,
- Mark
Cheers,
- Mark
August 14, 2003 at 10:56 am
Thank you very much, guys, for the input.
Mark, your script worked great. I wonder if you could help me understand the following line. What does ISNULL(@kill , '') do in the statement? Thanks again.
select @kill = ISNULL(@kill , '') + ' kill ' + cast(spid as varchar) from sysprocesses where dbid = db_id('pubs')
August 14, 2003 at 11:35 am
The ISNULL(@kill , '') will replace the null value in @kill with a single space, this is needed because anything plus a null value results in a null.
jimmY
Work like you don't need the money.
Love like you've never been hurt.
And Dance like no one is watching.
Work like you don't need the money.
Love like you've never been hurt.
And Dance like no one is watching.
August 14, 2003 at 2:46 pm
Thank you for the explaination, Jimmy.
August 14, 2003 at 3:17 pm
Thanks Jimmy.
Time zone sometimes prevent a prompt reply.
Cheers,
- Mark
Cheers,
- Mark
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply