--1--Get the list of all Logins in SQL Server SELECT name AS Login_Name, type_desc AS Account_Type FROM sys.server_principals WHERE TYPE IN ('U', 'S', 'G') and name not like '%##%' ORDER BY name, type_desc --2--List of all SQL Logins only SELECT name FROM sys.server_principals WHERE TYPE = 'S' and name not like '%##%' --3--Get the list … Continue reading All Logins in sql server
Day: January 31, 2020
All active users in server
--1-- To check last login time of sql server login SELECT MAX(login_time) AS [Last Login Time], login_name [Login] FROM sys.dm_exec_sessions GROUP BY login_name; --2--To check the last login date/time of a connection SELECT MAX(login_time) AS [Last Login Time], login_name [Login] FROM sys.dm_exec_sessions GROUP BY login_name order by 1 desc --3--To check the number of connections … Continue reading All active users in server
Search a text in stored procedures
Create Proc dbo.abc as begin select getdate() as 'Today' end SELECT OBJECT_NAME(id) FROM SYSCOMMENTS WHERE [text] LIKE '%Today%' AND OBJECTPROPERTY(id, 'IsProcedure') = 1 GROUP BY OBJECT_NAME(id)