Executing SP to check who is currently logon in the SQL working fine in Development database.But executing same SP in LIVE database only return 1 "runnable" record.
Both databases are reside in same physical SQL server. Had compare 2 database using some external freeware and shareware, can't find any difference especially on "Users and Roles" or "DB Properties".
Appreciate if got any solutions or suggestions.
Thanks to David.Chu.ca for the following store procedure.
*======================================================
USE [SAFEQA]
GO
/****** Object: StoredProcedure [dbo].[sp_checkUserID] Script Date: 12/09/2009 09:11:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_checkUserID]
WITH EXECUTE AS OWNER
AS
begin
DECLARE @retTable TABLE (
SPID int not null
, Status varchar (50) not null
, Login varchar (50) not null
, HostName varchar (50) not null
, BlkBy varchar(50) not null
, DBName varchar (50) null
, Command varchar (50) not null
, CPUTime int not null
, DiskIO int not null
, LastBatch varchar (50) not null
, ProgramName varchar (100) null
, SPID2 int not null
, REQUESTID INT)
INSERT INTO @retTable EXEC sp_who2
SELECT Status, Login, HostName, DBName, Command, CPUTime, ProgramName -- *
FROM @retTable
--WHERE Login not like 'sa%' -- if not intereted in sa
ORDER BY Login, HostName
END
*====================================================================