TSQL Circle Live

Blog Post

Find Most executed queries

SELECT TOP 50
QueryState.execution_count
,OBJECT_NAME(objectid)
,query_text = SUBSTRING(
qt.text,
QueryState.statement_start_offset/2,
(CASE WHEN QueryState.statement_end_offset = -1
THEN len(convert(nvarchar(max), qt.text)) * 2
ELSE QueryState.statement_end_offset
END - QueryState.statement_start_offset)/2)
,qt.dbid
,dbname = db_name(qt.dbid)
,qt.objectid
FROM sys.dm_exec_query_stats QueryState
CROSS APPLY sys.dm_exec_sql_text(QueryState.sql_handle) as qt
ORDER BY...

2018-09-18

2,054 reads

Blog Post

Get all queries running against any specific table

/*Get list of all queries hitting any specific tables*/SELECT DISTINCT TOP 100ProcedureName = OBJECT_SCHEMA_NAME(sqlTxt.objectid) + '.' + OBJECT_NAME(sqlTxt.objectid),SQLStatement = SUBSTRING(sqlTxt.Text,(QueryState.statement_start_offset/2)+1,CASE QueryState.statement_end_offsetWHEN -1 THEN DATALENGTH(sqlTxt.text)ELSE QueryState.statement_end_offsetEND...

2018-09-18

3,720 reads

Blogs

Capturing errors and auditing in Azure SQL DB

By

Logging is a necessity in the database world, well, the entire tech world. You...

Stepping into Event Streaming with Microsoft Fabric

By

(2025-July-06) Very often, real-time, high-speed streams of events come from IoT devices, social media...

Sabbatical le Troisième: A Recharge Week

By

It’s been a week since I flew home from London and Redgate to begin...

Read the latest Blogs

Forums

Unlock Excel’s Hidden Power: 10 Must-Know Features for Accountants

By Averyfoster99

Discover the top Excel features for accountants that supercharge productivity—from PivotTables and Power Query...

The Mindset of a Database Administrator: A Love Letter to Risk Aversion

By dbakevlar

Comments posted to this topic are about the item The Mindset of a Database...

Unmasking CXPACKET and CXCONSUMER in SQL Server: What Your Execution Plan Isn’t Telling You

By Chandan Shukla

Comments posted to this topic are about the item Unmasking CXPACKET and CXCONSUMER in...

Visit the forum

Question of the Day

Independence Day

The film independence day was released in 1996. Which of these queries returns that year is run today?

See possible answers