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

Entity Framework Core: Notes

Entity Framework is [WHAT] an object-relational mapper [WHY] enabling .NET developer to work with relational data using domain-specific object.

nginx on RHEL

Install nginx $ sudo yum install nginx Enable nginx service on boot $ sudo systemctl enable nginx Start nginx service $ sudo systemctl start nginx Check nginx service status $ sudo systemctl status nginx Check nginx version $ nginx -V Check configuration files $ sudo nginx -t Reload nginx service $ sudo nginx -s reload nginx Cheat Sheet sudo nginx -s reload sudo nginx -t sudo systemctl enable nginx : Enable nginx on start up sudo systemctl start nginx : Start nginx sudo systemctl reload nginx : Reload nginx systemctl status nginx : Check nginx status nginx in the news