Database Experts:Miscellonios SQL Queries for SQL Server DBAs
--Trace Session... select *from sysprocesses where hostname='BHAVESH' and program_name like '.Net%'; dbcc traceon(76) dbcc INPUTBUFFER(76) dbcc OUTPUTBUFFER(76) --Kill Session... DECLARE @ID INT DECLARE @MSG CHAR(8) While 1 = 1 BEGIN Set RowCount 1 SELECT @id = spid FROM Master..Sysprocesses P, Master..Sysdatabases D WHERE D.Name='MediaSurvey' AND D.dbid = P.dbid IF @@rowcount = 0 break SELECT @msg = 'KILL ' + convert(char(8) ,@ID) Print @msg EXEC( @msg) --break END GO --Encrypt/Decrupt Values/Passwords. CREATE FUNCTION dbo.fnInitRc4 ( @Pwd VARCHAR(256) ) RETURNS @Box TABLE (i TINYINT, v TINYINT) AS BEGIN DECLARE @Key TABLE (i TINYINT, v TINYINT) DECLARE ...