Array
(
)

Detach

By_gandalf
   - 25 mai 2005

Ola pessoal.

Como faço para derrubar usuarios via comando no sql server 2000?

Obrigado!

Ricardo Gavira
DigithoBrasil

Marcus.magalhaes
   - 27 mai 2005

Bom dia.

Utilize o comando kill

Ex.:

Declare @var_spid Int,
@var_command VarChar(255)

Declare cur_CONEXAO Cursor For Select spid From master..sysprocesses (NoLock) Where spid <> @@spid
Open cur_CONEXAO

Fetch Next From cur_CONEXAO Into @var_spid
While (@@fetch_status = 0)
Begin
Set @var_command = ´kill ´ + Convert(VarChar, @var_spid)
Exec (@var_command)

Fetch Next From cur_CONEXAO Into @var_spid
End
Close cur_CONEXAO
Deallocate cur_CONEXAO
GO