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

IIS: Delete cached files on server running IIS

Delete cached files on server running IIS When changing css, javascript files, check to delete if IIS still caches old files in the default folder C:\inetpub\temp\IIS Temporary Compressed Files\<sitename>\$^_gzip_D^\ Apply to: IIS 8.5

Linux command: du - disk usage

Where have all my storage gone? du summarize disk usage of the set of FILEs, recursively for directories.

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'