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,051 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,717 reads

Blogs

2 Tips to a Working Schedule

By

When I watched the following video from Justin Sung, I realized that I am...

Monitoring SQL Server Performance with the Pure Storage FlashArray OpenMetrics Exporter

By

I’m excited to share a new open-source project I’ve been working on that combines...

Teaching at the SC Statewide Audit Conference

By

Instead of teaching the CISA exam prep course, I'm teaching in the IT track....

Read the latest Blogs

Forums

How to push PowerQuery results into SQL Server

By pietlinden

Sorry, me again. In my PowerQuery, I read a table out of a PDF...

cant that export task be scripted without ssis

By stan

hi, i'm archiving some dw stuff to tsv's.   i got the manual sequence working...

Dependency Chain

By Phil Parkin

I have not yet been able to come up with a tidy solution for...

Visit the forum

Question of the Day

Getting the Updated Column List

What happens when I run this code in SQL Server 2022?

UPDATE dbo.CustomerLarge
 SET CustomerContactFirstName = 'Andy'
 WHERE CustomerID = 1

SELECT COLUMNS_UPDATED()

See possible answers