日期:2014-05-18  浏览次数:20398 次

SQL SERVER2000中如何控制同一用户多次登陆?
SQL SERVER2000中如何控制同一用户多次登陆?请给出具体代码最好

------解决方案--------------------
SQL code
DECLARE @spids VARCHAR(100)
--SELECT a.spid,a.logiName,a.login_time FROM sysprocesses a
SELECT @spids=ISNULL(@spids+',','') + RTRIM(a.spid)
    FROM sysprocesses a
FULL JOIN sysprocesses b
    ON a.loginame=b.loginame
    WHERE b.spid=@@spid
PRINT @spids
--觉得哪个不爽,用 KILL spid将进程杀掉

------解决方案--------------------
SQL code
DECLARE @spids VARCHAR(1000)
SELECT @spids=ISNULL(@spids+'KILL ','KILL ') + RTRIM(a.spid)+';' FROM sysprocesses a
FULL JOIN sysprocesses b
    ON a.loginame=b.loginame
    WHERE b.spid=@@spid AND a.spid!=@@spid
--PRINT @spids
EXEC(@spids)