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

RHEL: Install MySQL

[tuyendq@DangQuocTuyen ~]$ sudo yum list mysql Loaded plugins: product-id, search-disabled-repos, subscription-manager Error: No matching Packages to list [tuyendq@DangQuocTuyen ~]$ sudo yum install mysql Loaded plugins: product-id, search-disabled-repos, subscription-manager Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.60-1.el7_5 will be installed --> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-5.5.60-1.el7_5.x86_64 --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================= Package Arch Version Repository Size ================================...

Who is logged on to Windows

query user Check who is logged on to Windows: query user In Linux: who

IBM Domino: Exprired password

Your account is locked out if you do not change your expired password. IBM Notes: Password is expired Account is locked out when password is expired Example of password policy