Kamis, 02 September 2010
T-SQL: Disconnect Users from a Database
ניתן ל"נתק" משתמשים מבסיס נתונים של SQL Server באמצעות T-SQL:USE mastergoDECLARE @dbname varchar(30), @spid varchar(10), @start datetimeSELECT @start = current_timestamp, @dbname = 'DataBase Name' while(exists(Select * FROM sysprocesses WHERE dbid = db_id(@dbname)) AND datediff(mi, @start, current_timestamp) < 5) begin DECLARE spids CURSOR FOR SELECT convert(varchar,
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar