SQL Server High CPU

Troubleshoot high CPU from specific queries https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/performance/troubleshoot-high-cpu-usage-issues Identify Queries Contributing to High CPU SELECT TOP 10 s.session_id,            r.status,            r.cpu_time,   …

MS SQL Server Database Logging

In order to enable MSSQL Server database logging into the MSSQL Log 1). Open an elevated Poershell prompt 2). Run the query Invoke-Sqlcmd -Query "EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’AuditLevel’, REG_DWORD, …

Database Repair MSSQL

Command: DBCC CHECKDB Returned: DBCC results for ‘AP_TypeLocations’. There are 3004 rows in 14 pages for object "AP_TypeLocations". Msg 8976, Level 16, State 1, Line 1 Table error: Object ID …

MSSQL Transaction Log Full

Check Log Space in MSSQL Server DBCC SQLPERF(‘logspace’) If the error occurs: The transaction log for database ‘AIMS’ is full due to ‘ACTIVE_TRANSACTION’ Alter the logging levels of the database …

MS SQL Determine Enterprise Features

Use the following to determine if your MSSQL database has features only available inĀ enterprise versions of the product (partitioning, compression, encryption, etc). select * from sys.dm_db_persisted_sku_features

TSQL is decimal an INT

Determine if a decimal number can be converted to an INT without any loss of precision. Check if either of the rightmost two digits are non-zero substring(convert(varchar(10), a.DebitAmount), len(convert(varchar(10), a.DebitAmount)) …