Skip to main content

[MSSQL]: Common T-SQL



-- Check version
PRINT @@Version


SELECT * FROM sys.configurations


-- Show all processes
SELECT * FROM sys.sysprocesses


-- Check active connections
SELECT DB_NAME(dbid) AS DBName, COUNT(dbid) AS NumberOfConnections, loginame
FROM sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)



-- Check Collation used by all databases
USE Master
GO 
SELECT NAME, COLLATION_NAME 
FROM sys.Databases 
ORDER BY DATABASE_ID ASC 
GO

-- Enable 'sa' login
ALTER LOGIN [sa] ENABLE
GO

Popular posts from this blog

Docker: Commonly Used Commands

Repeat to remember Remember to repeat

Windows 10: Install SuSE Linux Enterprise - SLES

With Microsoft-Windows-Subsystem-Linux feature enabled, we can install Linux distributions on Windows 10.

Linux command: Ways to Find Hostname

hostname uname -n n stands for nodename hostname -f f stands for FQDN