Arun Kumar

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

257 reads

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

157 reads

Blogs

VMworld 2020 SQL Server session preview

By

Join me, David Klee, Microsoft Data Platform MVP and VMware vExpert, for a preview...

A new malware attack on SQL Server

By

Tencent Security has released a report (written in Chinese) describing a new malware attack by...

Azure Synapse Analytics overlooked features

By

There are some options in Azure Synapse Analytics that are not obvious that I...

Read the latest Blogs

Forums

SQL Agent error history

By sizal0234

Is there a way to capture 2 things, when did the job failed and...

Import csv file into existing table where 1st row has sep=,

By andrewjmdata

Hi, I have a csv file that has the value "sep=," in the first...

Inserts not propagated in transactional replication

By tttcoding

Hello, I have a transactional replication configured which subscription fails to sync to often...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers