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

1,103 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

2,030 reads

Blogs

Migrating from EverNote to Joplin

By

Recently I got a message that my Evernote subscription was going up. It’s been...

Using Data Masker on Chinese Surnames

By

A customer had a question recently on masking Chinese characters. I thought that was...

A New Word: Looseleft

By

looseleft – the feeling of loss upon finishing a good book, sensing the weight...

Read the latest Blogs

Forums

Database copy issue through - COPY DB WIZARD

By Kaushik Parui

I have a production server with SQL server 2016 version (13.0.5026.0) and a database...

Help with a SQL Unpivot

By rogue1009

I am trying to use unpivot to extract some data, however, the results are...

how to de escalte a isolation level, and are there any implications.

By rajemessage 14195

hi, I have one nested transaction and want to deescalate to outer  transaction's isolation/...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers