info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance






November 26, 2025

Determine which Replica has the most up-to-date database in a Microsoft SQL Server Always On Availability Group
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_hadr_database_replica_states
Read More
Tags TSQL
June 19, 2025

Always On Seeding Status (run in Primary Replica)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_exec_requests, sys.dm_hadr_automatic_seeding, sys.availability_databases_cluster, sys.availability_groups, sys.dm_hadr_physical_seeding_stats
Read More
Tags TSQL
March 26, 2025

SQL Server Always On Availability Groups Synchronization Lag
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_hadr_database_replica_states, sys.availability_replicas, sys.dm_hadr_availability_replica_states
Read More
Tags TSQL
February 10, 2025

Get SSIS Package Last Execution Status w/ SQL Job Name
by BFarrell (Principal Consultant; Architecture; Engineering)
SSISDB.Catalog.Executions, msdb.dbo.sysjobs , msdb.dbo.sysjobsteps
Read More
Tags TSQL
February 3, 2025

Database Files Usage Statistics
by BFarrell (Principal Consultant; Architecture; Engineering)
fn_virtualfilestats, sys.master_files
Read More
Tags TSQL
October 21, 2024

Distributed Always On Group Scripts
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.availability_groups, sys.availability_replicas, sys.dm_hadr_availability_replica_states
Read More
Tags TSQL
June 16, 2024

Automated Log Shipping Setup for Numerous User Databases
by BFarrell (Principal Consultant; Architecture; Engineering)
Invoke-DbaDbLogShipping
Read More
Tags TSQL
November 4, 2023

Check Always On Availability Groups Health
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_hadr_database_replica_states
Read More
Tags TSQL
October 24, 2023

Get all Tables, Primary Keys & Column(s)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.tables, sys.indexes, sys.index_columns, sys.columns
Read More
Tags TSQL
October 1, 2023

SQL Server OPTION (FAST N)
by BFarrell (Principal Consultant; Architecture; Engineering)
Query Optimizer
Read More
Tags TSQL
July 23, 2023

Microsoft SQL Server Database Files Space Report
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.database_files, sys.filegroups
Read More
Tags TSQL
January 10, 2023

Get all Forced Plans from the Query Store
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.query_store_plan, sys.query_store_query, sys.query_store_query_text, sys.query_store_runtime_stats
Read More
Tags TSQL
December 4, 2022

Get Disk Database Files Mount Points
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_os_volume_stats
Read More
Tags TSQL
November 13, 2022

Compare SQL Agent Job Runtime for a certain day of the week
by BFarrell (Principal Consultant; Architecture; Engineering)
A Migration Performance Check Item
Read More
Tags TSQL
October 8, 2022

High CPU Pressure
by BFarrell (Principal Consultant; Architecture; Engineering)
Signal Wait Time
Read More
Tags TSQL
September 12, 2022

Transactional Replication Distribution Delivery Status
by BFarrell (Principal Consultant; Architecture; Engineering)
MSdistribution_status, MSarticles, MSreplication_monitordata
Read More
Tags TSQL
July 6, 2022

Check TDE progress
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_database_encryption_keys
Read More
Tags TSQL
June 20, 2022

SQL Agent Jobs - Enable, Disable, Stop - Commands
by BFarrell (Principal Consultant; Architecture; Engineering)
sysjobs, sysjobhistory, sysjobschedules, sysoperators
Read More
Tags TSQL
May 20, 2022

Always On Synch Lag
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_hadr_database_replica_states, sys.availability_replicas, sys.dm_hadr_availability_replica_states
Read More
Tags TSQL
May 10, 2022

Get Table Information
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.tables, sys.columns, sys.types, sys.partitions
Read More
Tags TSQL
May 8, 2022

Get CPU Usage Information
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_os_ring_buffers, sys.dm_exec_requests, sys.dm_exec_query_stats
Read More
Tags TSQL
March 10, 2022

Get The TEQ (Top Expensive Queries)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_exec_query_stats
Read More
Tags TSQL
February 16, 2022

Statistics Objects Information
by BFarrell (Principal Consultant; Architecture; Engineering)
Column Statistics and Index Statistics
Read More
Tags TSQL
February 8, 2022

File Usage Statistics
by BFarrell (Principal Consultant; Architecture; Engineering)
fn_virtualfilestats
Read More
Tags TSQL
January 3, 2022

Index Usage Statistics
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.indexes, sys.dm_db_index_usage_stats, sys.dm_db_partition_stats
Read More
Tags TSQL
October 11, 2021

SQL Server Automated Database Migration using Backup & Restore Method (v2)
by BFarrell (Principal Consultant; Architecture; Engineering)
FULL, DIFFERENTIAL, LOG
Read More
Tags TSQL
July 17, 2021

List all Databases on an Instance with user created Service Broker Queues
by BFarrell (Principal Consultant; Architecture; Engineering)
Service Broker
Read More
Tags TSQL
April 4, 2021

Get all Ports configured in Always On Availability Groups Environment
by BFarrell (Principal Consultant; Architecture; Engineering)
Enter Short Description Here
Read More
Tags TSQL
November 28, 2020

Determine if your current UDFs are inlineable to benefit from SQL Server 2019 performance boost
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.sql_modules, sys.objects
Read More
Tags TSQL
October 31, 2020

Automate Enable or Disable SQL Jobs in Always On Nodes
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.availability_groups_cluster, sys.dm_hadr_availability_replica_cluster_states, sys.dm_hadr_availability_replica_states, sys.availability_group_listeners, sysjobs
Read More
Tags TSQL
September 1, 2020

Get number of Pending IO's
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_io_pending_io_requests
Read More
Tags TSQL
May 12, 2020

Always On - Check if Primary Replica
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.availability_groups_cluster, sys.dm_hadr_availability_replica_cluster_states, sys.dm_hadr_availability_replica_states, sys.availability_group_listeners
Read More
Tags TSQL
August 26, 2019

Microsoft SQL Server - Database Compression Estimator (PAGE and ROW)
by BFarrell (Principal Consultant; Architecture; Engineering)
sp_estimate_data_compression_savings
Read More
Tags TSQL
July 14, 2019

Get SQL Agent Job Last Run Status
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.sysjobservers, msdb.dbo.sysjobs
Read More
Tags TSQL
May 24, 2019

Get SQL Server Modules loaded
by BFarrell (Principal Consultant; Architecture; Engineering)
SQL Server VAS (Virtual Address Space)
Read More
Tags TSQL
May 3, 2019

View SQL Job Last Status in Microsoft System Center
by BFarrell (Principal Consultant; Architecture; Engineering)
OperationsManager
Read More
Tags TSQL
January 30, 2019

SQL Jobs Monitor
by BFarrell (Principal Consultant; Architecture; Engineering)
Receive alerts on any SQL Jobs Failed
Read More
Tags TSQL
January 21, 2019

Log Shipping Real-Time Processing Engine v2
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.restorehistory, msdb.dbo.backupset, msdb.dbo.backupmediaset, msdb.dbo.backupmediafamily
Read More
Tags TSQL
January 15, 2019

T-SQL - Using Bitwise Operators to store multiple values in one column
by BFarrell (Principal Consultant; Architecture; Engineering)
Bitwise operators perform bit manipulations between two expressions of any of the data types of the integer data type category...
Read More
Tags TSQL
December 6, 2018

T-SQL Monitor TempDB Usage
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.database_files, sys.dm_os_performance_counters, sys.dm_db_file_space_usage
Read More
Tags TSQL
December 3, 2018

T-SQL - Dynamically Re-Size TempDB Files
by BFarrell (Principal Consultant; Architecture; Engineering)
Alter Database tempdb Modify File
Read More
Tags TSQL
December 3, 2018

Distribution Database in Recovery Pending State
by BFarrell (Principal Consultant; Architecture; Engineering)
Alter Database Modify File
Read More
Tags TSQL
November 23, 2018

SQL Server Reporting Services - Report Usage Stats
by BFarrell (Principal Consultant; Architecture; Engineering)
ExecutionLog2
Read More
Tags TSQL
November 23, 2018

T-SQL List Permissions for an Object
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.objects, sys.database_permissions, sys.database_principals
Read More
Tags TSQL
November 1, 2018

T-SQL Delete Extra TempDB Data Files
by BFarrell (Principal Consultant; Architecture; Engineering)
Alter Database Remove File
Read More
Tags TSQL
October 31, 2018

T-SQL - Get Transaction Log Restore History on the Secondary Database Server for any Log Shipped Database(s)
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.backupset, msdb.dbo.backupmediaset, msdb.dbo.backupmediafamily
Read More
Tags TSQL
September 15, 2018

T-SQL Compare sys.database_files with sys.master_files
by BFarrell (Principal Consultant; Architecture; Engineering)
Output any differences with System Catalog Views
Read More
Tags TSQL
September 4, 2018

Query Cache Analysis
by BFarrell (Principal Consultant; Architecture; Engineering)
SQL_Handle, Plan_Handle, Query_Hash, Query_Plan_Hash, Query Cache Statistics, Plan Attributes
Read More
Tags TSQL
August 22, 2018

T-SQL - Check Always On Transactional Replication re-directed Publisher to Listener Name
by BFarrell (Principal Consultant; Architecture; Engineering)
dbo.sp_validate_redirected_publisher, dbo.sp_Validate_Replica_Hosts_As_Publishers, dbo.MSRedirected_Publishers
Read More
Tags TSQL
June 19, 2018

T-SQL Check if a Table has a ColumnStore Index
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.indexes
Read More
Tags TSQL
June 17, 2018

Fing Queries using Parallelism
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_exec_query_stats, sys.dm_exec_sql_text, sys.dm_exec_cached_plans, sys.dm_exec_query_plan, sys.dm_os_tasks, sys.dm_os_workers, sys.dm_os_waiting_tasks
Read More
Tags TSQL
June 6, 2018

Use SQLCMD Mode to connect to numerous SQL Instances & loop through all databases & execute query
by BFarrell (Principal Consultant; Architecture; Engineering)
SSMS..SQLCMD Mode
Read More
Tags TSQL
May 22, 2018

T-SQL - Log Linked Servers
by BFarrell (Principal Consultant; Architecture; Engineering)
[MASTER].sys.Servers, [MASTER].sys.linked_logins, [MASTER].sys.server_principals
Read More
Tags TSQL
May 18, 2018

Automate DBCC UpdateUsage per select list of databases
by BFarrell (Principal Consultant; Architecture; Engineering)
DBCC UPDATEUSAGE
Read More
Tags TSQL
May 18, 2018

Automate DBCC UpdateStats per select list of databases
by BFarrell (Principal Consultant; Architecture; Engineering)
Exec sp_updatestats
Read More
Tags TSQL
May 14, 2018

T-SQL - List Databases, Logins & SQL Jobs
by BFarrell (Principal Consultant; Architecture; Engineering)
master.sys.databases, master.sys.server_principals, msdb.dbo.sysjobs
Read More
Tags TSQL
May 6, 2018

T-SQL Generate Logins for a specific list of databases for Migration purposes
by BFarrell (Principal Consultant; Architecture; Engineering)
Use a Driver table for Database List
Read More
Tags TSQL
April 29, 2018

Running SQL Server Post-Installation Checks
by BFarrell (Principal Consultant; Architecture; Engineering)
Builds
Read More
Tags TSQL
April 28, 2018

Automate SQL Server Database Data & Log File Growth Sizes
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.master_files, sys.databases, sysaltfiles
Read More
Tags TSQL
April 28, 2018

SQL Server Automated Database Migration using Backup & Restore Method (v1)
by BFarrell (Principal Consultant; Architecture; Engineering)
FULL, DIFFERENTIAL, LOG
Read More
Tags TSQL
April 21, 2018

Monitor real-time query progress using sys.dm_exec_query_profiles DMV
by BFarrell (Principal Consultant; Architecture; Engineering)
Use this DMV to determine which part of the query is running slow.
Read More
Tags TSQL
April 13, 2018

Automate XCOPY of Database Data & Log Files
by BFarrell (Principal Consultant; Architecture; Engineering)
Useful for SQL Server Database Migrations that use DETACH & ATTACH process
Read More
Tags TSQL
March 23, 2018

Using Microsoft Data Migration Assistant and Extended Events to capture any Deprecated Features
by BFarrell (Principal Consultant; Architecture; Engineering)
sqlserver.deprecation_announcement, sqlserver.deprecation_final_support
Read More
Tags TSQL
March 22, 2018

Using Extended Events to capture failed logins
by BFarrell (Principal Consultant; Architecture; Engineering)
Enter Short Description Here
Read More
Tags TSQL
March 10, 2018

Using Extended Events to capture Stored Procedure calls, Log & Extract Duration Buckets of % and/or #
by BFarrell (Principal Consultant; Architecture; Engineering)
CREATE EVENT SESSION, ADD EVENT, ADD TARGET
Read More
Tags TSQL
January 23, 2018

Using Profiler to view SQL:StmtRecompiles and the EventSubClass to see the reason for a recompile (w/ Stored Procedure using Dynamic SQL)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.trace_events, sys.trace_subclass_values
Read More
Tags TSQL
December 18, 2017

Automate Database Attach or Detach of all User Databases for a Migration
by BFarrell (Principal Consultant; Architecture; Engineering)
sp_detach_db, sp_attach_db
Read More
Tags TSQL
December 12, 2017

Find Long Running Queries in SQL Server, Queries with High Execution Counts, Query Cache Analysis
by BFarrell (Principal Consultant; Architecture; Engineering)
Max Worker Time, Max Elapsed Time, Execution Counts, Last Elapsed Time
Read More
Tags TSQL
November 30, 2017

Automate DBCC CHECKDB Per Instance
by BFarrell (Principal Consultant; Architecture; Engineering)
Execute against each Database in the Instance + Log Results + Check for any errors + RaiseError(Alert)
Read More
Tags TSQL
November 29, 2017

SQL Server Transactional Replication Error: Count not find stored procedure sp_MSdel_TableName
by BFarrell (Principal Consultant; Architecture; Engineering)
sp_scriptpublicationcustomprocs (Transact-SQL)
Read More
Tags TSQL
November 18, 2017

Enable or Disable All SQL Jobs
by BFarrell (Principal Consultant; Architecture; Engineering)
MSDB..sysjobs
Read More
Tags TSQL
November 9, 2017

T-SQL - Query all SQL Server Error Log Files
by BFarrell (Principal Consultant; Architecture; Engineering)
xp_enumerrorlogs
Read More
Tags TSQL
November 8, 2017

T-SQL - Check Statistics Last Updated and Update All Statistics
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.stats, sys.stats_columns, sys.columns, sys.partitions, sys.objects
Read More
Tags TSQL
November 8, 2017

T-SQL - Find Missing Indexes - incl. Improvement Measure and Avg User Impact
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_db_missing_index_group, sys.dm_db_missing_index_group_stats, sys.dm_db_missing_index_details
Read More
Tags TSQL
September 26, 2017

T-SQL Index & Heap Space plus Rolled Up Table Space
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.tables, sys.schemas, sys.indexes, sys.partition, sys.allocation_units
Read More
Tags TSQL
September 9, 2017

SQL Replication Monitor
by BFarrell (Principal Consultant; Architecture; Engineering)
Captures, Logs, Alerts & Reports for Microsoft SQL Server Transaction Replication Distribution Metrics.
Read More
Tags TSQL
August 30, 2017

Get Number of Microsoft Systems Center (SCOM) Events Per ComputerName
by BFarrell (Principal Consultant; Architecture; Engineering)
EventallView
Read More
Tags TSQL
August 25, 2017

T-SQL Get SQL Server Transaction Log Backup Size (or Database Backup Size)
by BFarrell (Principal Consultant; Architecture; Engineering)
MSDB..backupset
Read More
Tags TSQL
August 22, 2017

Transaction Log Large File Size
by BFarrell (Principal Consultant; Architecture; Engineering)
800+GB Transaction Log File
Read More
Tags TSQL
August 18, 2017

SQL Server Database Transaction Log Backups - Activity-based (vs Time-based)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_db_log_stats
Read More
Tags TSQL
August 18, 2017

T-SQL - Get Stored Procedure Created and Modified Dates
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.objects, INFORMATION_SCHEMA.ROUTINES
Read More
Tags TSQL
August 17, 2017

Get Number of Microsoft Systems Center (SCOM) Monitor's State changes
by BFarrell (Principal Consultant; Architecture; Engineering)
StateChangeEvent, State, MonitorView, ManagedType
Read More
Tags TSQL
July 30, 2017

T-SQL - Get Logins Connect Permissions
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.server_principals, sys.server_permissions, sys.sql_logins
Read More
Tags TSQL
July 29, 2017

T-SQL - Get SQL Server Up-Time - Services, SysProcesses & TempDB
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_server_services, sysprocesses, sys.databases
Read More
Tags TSQL
July 26, 2017

T-SQL - Get list of Indexes with Fillfactor less than 90 (incl: #Pages, #Rows, % Fillfactor, % Fragmentation)
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_db_index_physical_stats, sys.indexes
Read More
Tags TSQL
July 24, 2017

T-SQL - Get Tables, Fields & Data Types
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.columns, sys.objects, sys.types
Read More
Tags TSQL
July 23, 2017

T-SQL - sp_clean_db_free_space
by BFarrell (Principal Consultant; Architecture; Engineering)
Removes residual information left on database pages because of data modification routines in SQL Server.
Read More
Tags TSQL
July 21, 2017

T-SQL Get Database Backups Throughput
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.backupset, msdb.dbo.backupmediafamily
Read More
Tags TSQL
July 19, 2017

T-SQL Display Operating System Version Information
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_os_windows_info vs sys.dm_os_host_info
Read More
Tags TSQL
July 12, 2017

SQL Space Monitor - Version 2
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.database, sys.master_files, sys.data_spaces, sys.dm_os_volume_stats, sp_send_dbmail
Read More
Tags TSQL
July 8, 2017

SQL Space Monitor - Version 1
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.database, sys.master_files, sys.data_spaces, sys.dm_os_volume_stats
Read More
Tags TSQL
July 5, 2017

Agent is retrying after an error. 65 retries attempted. See agent job history in the Jobs folder for more details.
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.sysjobhistory
Read More
Tags TSQL
June 30, 2017

High Memory Pressure
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.objects, sys.partitions, sys.allocation_units, sys.indexes, sys.dm_os_buffer_descriptors
Read More
Tags TSQL
June 28, 2017

Auditing SQL Server Systems - Logins
by BFarrell (Principal Consultant; Architecture; Engineering)
sp_readerrorlog, sp_helptext
Read More
Tags TSQL
June 25, 2017

SQL Server 2017 - sys.dm_db_log_info
by BFarrell (Principal Consultant; Architecture; Engineering)
A New DMF used to examine the structure of Transaction Log files and it is a replacement for DBCC LOGINFO. It returns VLF information of the Transaction Log Files.
Read More
Tags TSQL
June 24, 2017

SQL Server 2017 - sys.dm_os_enumerate_fixed_drives
by BFarrell (Principal Consultant; Architecture; Engineering)
A New DMV to identify free disk space. It is a replacement for XP_FIXEDDRIVES.
Read More
Tags TSQL
June 23, 2017

SQL Server 2017 - sys.dm_os_file_exists
by BFarrell (Principal Consultant; Architecture; Engineering)
A New inline TVF to check if a file exists or not. It is a replacement for XP_FILEEXIST.
Read More
Tags TSQL
June 20, 2017

SQL Server 2017 - sys.query_store_wait_stats
by BFarrell (Principal Consultant; Architecture; Engineering)
New in SQL Server 2017, it contains information about the Wait Stats for Queries in the Query Store. Query Store is a great feature to help with performances issues related to Plan changes.
Read More
Tags TSQL
June 19, 2017

sp_configure - RECONFIGURE or RECONFIGURE WITH OVERRIDE
by BFarrell (Principal Consultant; Architecture; Engineering)
SQL Server Configuration options are available to manage via SQL Server Management Studio Application (SSMS) or sp_configure stored procedure...
Read More
Tags TSQL
June 14, 2017

T-SQL Get Permissions for a Role
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.database_principals, sys.database_permissions, sys.schemas, sys.objects
Read More
Tags TSQL
June 7, 2017

sp_server_diagnostics
by BFarrell (Principal Consultant; Architecture; Engineering)
Captures diagnostic data and health information about SQL Server to detect potential failures. The procedure runs in repeat mode and sends results periodically.
Read More
Tags TSQL
June 7, 2017

Transactional Replication Monitoring - SQL Job Perspective - Last Run Time and Run Status
by BFarrell (Principal Consultant; Architecture; Engineering)
This query returns all Replication SQL Jobs and reports on it's Last Run Time and Run Status...
Read More
Tags TSQL
June 5, 2017

Capture Microsoft SQL Server Waits Stats
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_os_wait_stats - Returns information about all the waits encountered by threads that executed. Use this aggregated view to diagnose performance issues with SQL Server and also with specific queries and batches.
Read More
Tags TSQL
June 3, 2017

T-SQL List Database or Log Backups
by BFarrell (Principal Consultant; Architecture; Engineering)
Backupset - Contains a row for each backup set. A backup set contains the backup from a single, successful backup operation. Backupmediafamily - Contains one row for each media family.
Read More
Tags TSQL
May 31, 2017

How to Monitor Log Shipping in SQL Server
by BFarrell (Principal Consultant; Architecture; Engineering)
Log shipping allows you to automatically send transaction log backups from a PRI DB on a PRI Server to one or more SEC DB(s) on separate SEC Server(s)...
Read More
Tags TSQL
May 29, 2017

T-SQL Getdate as Integer
by BFarrell (Principal Consultant; Architecture; Engineering)
With Time, With Uniqueidentifier
Read More
Tags TSQL
May 12, 2017

Log Reader Agent not starting after AlwaysON Availability Groups Failover
by BFarrell (Principal Consultant; Architecture; Engineering)
During recent testing of a new Microsoft Azure Cloud setup of SQL Server 2016 Standard running Always On Availability Groups Basic...
Read More
Tags TSQL
April 11, 2017

T-SQL - Constants vs Parameters vs Local Variables - Execution Plans, Statistics, Assumptions
by BFarrell (Principal Consultant; Architecture; Engineering)
Procedure Cache, Parameter Sniffing, SSMS Compare Execution Plans Tool, SSMS Live Execution Plan Tool
Read More
Tags TSQL
March 30, 2017

SQL Server - File IO - Sizes, Usage, Stats - Write(Insert) vs Read(Select)
by BFarrell (Principal Consultant; Architecture; Engineering)
SSMS, Process Monitor
Read More
Tags TSQL
March 29, 2017

SQL Server Database Mail - Success, Failure, Logs, Config
by BFarrell (Principal Consultant; Architecture; Engineering)
msdb.dbo.sysmail_sentitems, msdb.dbo.sysmail_faileditems, msdb.dbo.sysmail_event_log, msdb.dbo.sysmail_configuration
Read More
Tags TSQL
March 16, 2017

Microsoft SQL Server Replication - Distribution - CmdsPerSec Delivery Rate Dropped
by BFarrell (Principal Consultant; Architecture; Engineering)
Distribution.dbo.MSdistribution_history
Read More
Tags TSQL
February 2, 2017

T-SQL Transform Row Data into Columns using PIVOT
by BFarrell (Principal Consultant; Architecture; Engineering)
Example - Transactional Replication Pending Commands
Read More
Tags TSQL
January 27, 2017

List all SQL Server Reporting Services Subscriptions
by BFarrell (Principal Consultant; Architecture; Engineering)
SQL Server Reporting Services(SSRS) is a Microsoft solution that provides customers with the ability to create, publish and manage reports...
Read More
Tags TSQL
January 27, 2017

SQL Server Get Latest Database or Log Backup History
by BFarrell (Principal Consultant; Architecture; Engineering)
DB, Log, Diff
Read More
Tags TSQL
January 18, 2017

Calculate RTO(Recovery Time Objective) in AlwaysON Availability Groups
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.dm_hadr_availability_replica_cluster_nodes, sys.dm_hadr_availability_replica_cluster_states, sys.dm_hadr_availability_replica_states, sys.dm_hadr_database_replica_states, sys.availability_replicas
Read More
Tags TSQL
January 12, 2017

T-SQL Get Maximum Value from a list of Columns Values
by BFarrell (Principal Consultant; Architecture; Engineering)
VALUES Clause...
Read More
Tags TSQL
January 3, 2017

DBCC CLONEDATABASE
by BFarrell (Principal Consultant; Architecture; Engineering)
Generates a Schema and Statistics only copy...
Read More
Tags TSQL
January 1, 2017

SQL Server 2016 Compress() & Decompress()
by BFarrell (Principal Consultant; Architecture; Engineering)
Built-in T-SQL functions in SQL Server 2016
Read More
Tags TSQL
December 30, 2016

JSON in SQL Server 2016
by BFarrell (Principal Consultant; Architecture; Engineering)
JSON_VALUE, JSON_QUERY, JSON_MODIFY, OPENJSON, FOR JSON
Read More
Tags TSQL
December 27, 2016

Temporal Tables in SQL Server 2016
by BFarrell (Principal Consultant; Architecture; Engineering)
A new type of user table in SQL Server 2016
Read More
Tags TSQL
December 17, 2016

T-SQL Merge
by BFarrell (Principal Consultant; Architecture; Engineering)
Inserting, Updating, and Deleting Data by Using MERGE
Read More
Tags TSQL
December 17, 2016

T-SQL Pivot Data
by BFarrell (Principal Consultant; Architecture; Engineering)
Pivoting the data based on a column values
Read More
Tags TSQL
December 13, 2016

Reseed Identity Column in a SQL Server Table
by BFarrell (Principal Consultant; Architecture; Engineering)
IDENTITY, DBCC CHECKIDENT
Read More
Tags TSQL
December 13, 2016

SQL Server Schema Change History
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.traces, fn_trace_gettable, fn_dblog, SSMS Report
Read More
Tags TSQL
December 9, 2016

T-SQL - Recursive CTE's
by BFarrell (Principal Consultant; Architecture; Engineering)
Generate a List of Numbers, Generate a List of dates(DATEFROMPARTS, EOMONTH, MAXRECURSION), Navigate a Hierarchy
Read More
Tags TSQL
December 8, 2016

Add a new Article to an existing Publication in Transactional Replication (Push Subscription) using T-SQL
by BFarrell (Principal Consultant; Architecture; Engineering)
sp_helppublication, sp_helpsubscription, sp_addarticle, sp_addsubscription
Read More
Tags TSQL
December 6, 2016

Retrieving the input buffer in SQL Server 2016 using the new Dynamic Management Function - sys.dm_exec_input_buffer
by BFarrell (Principal Consultant; Architecture; Engineering)
Functionally equivalent to DBCC INPUTBUFFER
Read More
Tags TSQL
December 6, 2016

T-SQL Delete Duplicate Records
by BFarrell (Principal Consultant; Architecture; Engineering)
CTE, Row_Number(), Over(Partition by)
Read More
Tags TSQL
December 5, 2016

T-SQL Create a Distinct Comma Separated List of Postal Codes
by BFarrell (Principal Consultant; Architecture; Engineering)
COALESCE
Read More
Tags TSQL
December 5, 2016

T-SQL - Extract out the Date within File Names
by BFarrell (Principal Consultant; Architecture; Engineering)
SUBSTRING Function w/ PATINDEX(Pattern Index Function) and a REGEX(Regular Expression)
Read More
Tags TSQL
November 29, 2016

Microsoft SQL Server Replication - Log Reader Agent - History, Status & Configuration
by BFarrell (Principal Consultant; Architecture; Engineering)
MSlogreader_history, MSlogreader_agents, sp_replcmds
Read More
Tags TSQL
November 4, 2016

T-SQL Get Replication Distribution History Errors
by BFarrell (Principal Consultant; Architecture; Engineering)
MSdistribution_history, MSdistribution_agents
Read More
Tags TSQL
October 15, 2016

T-SQL Analytic Functions FIRST_VALUE(), LAST_VALUE(), LEAD(), LAG()
by BFarrell (Principal Consultant; Architecture; Engineering)
Analytic functions compute an aggregate value based on a group of rows. However, unlike aggregate functions, they can return multiple rows for each group.
Read More
Tags TSQL
October 15, 2016

T-SQL Ranking Functions ROW_NUMBER(), RANK(), DENSE_RANK(), NTILE()
by BFarrell (Principal Consultant; Architecture; Engineering)
Ranking functions return a ranking value for each row in a partition
Read More
Tags TSQL
October 13, 2016

T-SQL Get Total Database Size
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.databases, sys.master_files
Read More
Tags TSQL
October 7, 2016

Objects exposing columns with CLR types are not allowed in distributed queries. Please use a pass-through query to access remote object...
by BFarrell (Principal Consultant; Architecture; Engineering)
OPENQUERY
Read More
Tags TSQL
October 6, 2016

Azure SQL Database Geo-Replication Logins and Users Configuration
by BFarrell (Principal Consultant; Architecture; Engineering)
Create Login, Create User, sys.sql_logins , sys.database_principals
Read More
Tags TSQL
October 3, 2016

Azure SQL Database Geo-Replication - Initiate a Failover using T-SQL
by BFarrell (Principal Consultant; Architecture; Engineering)
Alter Database FAILOVER, sys.dm_geo_replication_link_status, sys.dm_operation_status
Read More
Tags TSQL
September 9, 2016

SQL Server List all Tables with no Primary Key
by BFarrell (Principal Consultant; Architecture; Engineering)
information_schema.tables, sys.tables, replication
Read More
Tags TSQL
September 2, 2016

T-SQL SET PARSEONLY ON vs SET NOEXEC ON vs SET FMTONLY ON
by BFarrell (Principal Consultant; Architecture; Engineering)
Parsing T-SQL Statements
Read More
Tags TSQL
August 28, 2016

Use Extended Events to capture Deadlocks in SQL Server
by BFarrell (Principal Consultant; Architecture; Engineering)
Histogram, XQuery
Read More
Tags TSQL
August 22, 2016

T-SQL Log Long Running Open Transactions
by BFarrell (Principal Consultant; Architecture; Engineering)
Transaction Log Size, Number of VLF(Virtual Log Files), Connection Details
Read More
Tags TSQL
August 10, 2016

Transactional Replication - Out of Synchronization
by BFarrell (Principal Consultant; Architecture; Engineering)
SkipErrors, Validate Subscriptions
Read More
Tags TSQL
July 20, 2016

SQL Server Replication Get Undistributed Commands
by BFarrell (Principal Consultant; Architecture; Engineering)
Distribution.sys.sp_MSget_repl_commands
Read More
Tags TSQL
July 17, 2016

SQL Server Distribution Agent is retrying after an error
by BFarrell (Principal Consultant; Architecture; Engineering)
Transactional Replication, Distribution.dbo.MSdistribution_history, Distribution Retention Period
Read More
Tags TSQL
July 14, 2016

View Microsoft SQL Server Replication Publication details
by BFarrell (Principal Consultant; Architecture; Engineering)
Publication Name, Publication DB, Article Name, Distribution Name, Subscriber Name, Subscriber DB
Read More
Tags TSQL
June 30, 2016

How to prevent schema changes to tables configured for SQL Server Replication
by BFarrell (Principal Consultant; Architecture; Engineering)
Database-level Trigger
Read More
Tags TSQL
June 29, 2016

T-SQL Check the last X days for any SQL Agent Job steps that were retried
by BFarrell (Principal Consultant; Architecture; Engineering)
MSDN function dbo.agent_datetime for Date & Time, Filter out Replication Jobs
Read More
Tags TSQL
June 28, 2016

T-SQL Stuff() vs Replace()
by BFarrell (Principal Consultant; Architecture; Engineering)
Transact-SQL Functions
Read More
Tags TSQL
June 22, 2016

Capture Slow Stored Procedure Calls in Microsoft SQL Server using Extended Events
by BFarrell (Principal Consultant; Architecture; Engineering)
sqlserver.rpc_completed
Read More
Tags TSQL
June 10, 2016

TechDevOps.com shared a Session - "SQL Server Index Internals: A Deep Dive (Tim Chapman; Microsoft)"
by BFarrell (Principal Consultant; Architecture; Engineering)
PASS
Read More
Tags TSQL
May 9, 2016

T-SQL Cross Apply vs Derived Table vs Subquery
by BFarrell (Principal Consultant; Architecture; Engineering)
Enter Short Description Here
Read More
Tags TSQL
April 13, 2016

Rebuild Indexes based on Fragmentation Percent
by BFarrell (Principal Consultant; Architecture; Engineering)
T-SQL, Alter Index
Read More
Tags TSQL
February 5, 2016

T-SQL Query Tuning - Statistics, Histogram, Density, Selectivity & Cardinality
by BFarrell (Principal Consultant; Architecture; Engineering)
DBCC Show_Statistics, Set Statistics Profile, Set Statistics IO, Set Statistics Time, sp_updatestats, DBCC dropcleanbuffers, DBCC freeproccache
Read More
Tags TSQL
December 23, 2015

T-SQL subtract current row value from previous row value
by BFarrell (Principal Consultant; Architecture; Engineering)
LAG (Transact-SQL)
Read More
Tags TSQL
November 23, 2015

View Microsoft SQL Server Reporting Services Report Server Logs
by BFarrell (Principal Consultant; Architecture; Engineering)
Report Server Execution Log and the ExecutionLog3 View
Read More
Tags TSQL
November 8, 2015

Determine the progress of Microsoft SQL Server Backup or Restore
by BFarrell (Principal Consultant; Architecture; Engineering)
Using T-SQL get the Total Elapsed Time, Percentage Completed & Estimated Completion Time...
Read More
Tags TSQL
November 7, 2015

Microsoft Azure Blob Storage Service as a backup destination
by BFarrell (Principal Consultant; Architecture; Engineering)
Requires Storage Account, Container & Credential
Read More
Tags TSQL
November 2, 2015

Create an Extended Events session - Azure SQL Database
by BFarrell (Principal Consultant; Architecture; Engineering)
sqlserver.sql_batch_completed, ring_buffer
Read More
Tags TSQL
November 2, 2015

Create an Extended Events session - On-Prem
by BFarrell (Principal Consultant; Architecture; Engineering)
sqlserver.rpc_completed, sqlserver.sql_batch_completed, ring_buffer
Read More
Tags TSQL
November 1, 2015

Microsoft SQL Server Query Testing Tool
by BFarrell (Principal Consultant; Architecture; Engineering)
SQLQueryStress by http://www.datamanipulation.net/
Read More
Tags TSQL
October 12, 2015

List your SQL Server Replication Topology using T-SQL
by BFarrell (Principal Consultant; Architecture; Engineering)
Distributor, Publisher, Publications & Subscribers
Read More
Tags TSQL
October 7, 2015

Find hidden characters in a SQL Server table data
by BFarrell (Principal Consultant; Architecture; Engineering)
Using ASCII (Transact-SQL)
Read More
Tags TSQL
August 6, 2015

List information about all SQL Server Databases & Files
by BFarrell (Principal Consultant; Architecture; Engineering)
sys.master_files, sys.databases
Read More
Tags TSQL
August 5, 2015

SQL Server Connections - Schedulers, Threads, Workers, Tasks, Requests, Sessions, Connections, Users
by BFarrell (Principal Consultant; Architecture; Engineering)
Along with sys.messages & other resources
Read More
Tags TSQL
August 4, 2015

Find the DateDiff between separate log records with starttime and endtime
by BFarrell (Principal Consultant; Architecture; Engineering)
T-SQL query
Read More
Tags TSQL
August 2, 2015

Find a stored procedure call within a SQL Server Job
by BFarrell (Principal Consultant; Architecture; Engineering)
Using T-SQL, find a stored procedure call within a SQL Server Job step(s)
Read More
Tags TSQL
June 28, 2015

T-SQL - Find Lead Blocking SPID
by BFarrell (Principal Consultant; Architecture; Engineering)
Use T-SQL to find the lead blocking SPID and it's INPUTBUFFER contents.
Read More
Tags TSQL
June 28, 2015

Hash Lookup/Static Table Contents
by BFarrell (Principal Consultant; Architecture; Engineering)
T-SQL Solution for Hashing Lookup Table records in a Microsoft SQL Server Database. Required for data level Change Detection/Control implementations.
Read More
Tags TSQL
June 28, 2015

Use T-SQL to log Active SPID Execution Duration
by BFarrell (Principal Consultant; Architecture; Engineering)
Use T-SQL to capture, filter & log Active SPID Execution Duration for all active requests inside the Microsoft SQL Server Engine.
Read More
Tags TSQL
June 21, 2015

Concatenate Row Values using T-SQL
by BFarrell (Principal Consultant; Architecture; Engineering)
Concatenate Row Values in SQL Server using T-SQL's FOR XML and STUFF function.
Read More
Tags TSQL
Future Events
DevIntersection
Microsoft Ignite
PASS Summitt
Popular Tags
SQLServer
TSQL
CloudComputing
Azure
SQLServerReplication
SQLServerPerformance
SQLServerHealthCheck
Powershell
SQLServerAlwaysOn
AzureSQLDatabase
DataMigration
SQLServerReplicationMonitor
AzureVirtualMachine
SQLServer2016
ExtendedEvents
Metrics
QueryTuning
ReportingServices
SQLServerAgent
WindowsFailoverCluster
SQLServerManagementStudio
SQLServerTransactionLog
SQLServerArchitecture
IntegrationServices
DMVs
Pinned Posts
Microsoft SQL Server Always On Availability Groups Architecture Design
Create a Microsoft SQL Server Audit Report using Powershell
SQL Space Monitor - Version 2
T-SQL - Constants vs Parameters vs Local Variables - Execution Plans, Statistics, Assumptions
SQL Server - File IO - Sizes, Usage, Stats - Write(Insert) vs Read(Select)
Azure Virtual Machines running SQL Server 2016 STD AlwaysON Availability Groups w/ Transactional Replication
T-SQL Transform Row Data into Columns using PIVOT
List all SQL Server Reporting Services Subscriptions
Calculate RTO(Recovery Time Objective) in AlwaysON Availability Groups
T-SQL Get Maximum Value from a list of Columns Values
SQL Server 2016 Compress() & Decompress()
JSON in SQL Server 2016
Temporal Tables in SQL Server 2016
T-SQL Merge
T-SQL Pivot Data


©2015 www.TechDevOps.com