|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to kick all users out of a databaseHi
I am doing log shipping on sql 2000 and want to kick all users out of the database before applying the backup or the log. What I am doing is writing a cursor which will read sysprocesses to see which users are in the db. I filter on db_id =db_id('pubs') Then I kill all the spids. I repeat a second time in case there are any hangers on. Is there a better way of doing this? Yes: look up ALTER DATABASE in Books Online. Look for "SET SINGLE_USER" .
ML --- http://milambda.blogspot.com/ Thanks ML, but the problem is that I can't do this in the proc I use to
restore the tlog. Any other ideas? ML wrote: Show quoteHide quote > Yes: look up ALTER DATABASE in Books Online. Look for "SET SINGLE_USER" . > > > ML > > --- > http://milambda.blogspot.com/ It works! Thanks ML!
PamelaFoxcr***@gmail.com wrote: Show quoteHide quote > Thanks ML, but the problem is that I can't do this in the proc I use to > restore the tlog. > > Any other ideas? > ML wrote: > > Yes: look up ALTER DATABASE in Books Online. Look for "SET SINGLE_USER" . > > > > > > ML > > > > --- > > http://milambda.blogspot.com/
how to: INSERT IGNORE INTO?
dynamic sql in UDF Timeout sql+asp URGENT !!! SELECT * returning different set of records TSQL bit manipulation up to 128 bits??? more complex many to many table query Dictionary Sorting Weirdness SQL Server 2000 conversion of varchar to smallint show dependencies of a fact table SQL Parser |
|||||||||||||||||||||||