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

Online Learning: Free to Learn, Learn to Free

Photo Credit:  Gerd Altmann - pixabay.com Just make time to keep learning, practicing, and sharing.

Install the .NET Core Windows Server Hosting bundle

Remember to schedule in advance, since IIS must be reset after installing .NET Core Windows Server Hosting bundle.

Synology: Commonly Used Commands

Commonly used commands via ssh with Synology NAS.