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,994 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,590 reads

Blogs

How-To Convert Excel Date & Time to SQL

By

Hey data friends! This one comes from my personal vault (aka backlog of drafts...

SQL in 2025: Still the King of Data

By

Data's the new oil, and SQL is your refinery. It's still the go-to language...

Drop roles in Postgres

By

You can’t just exec DROP ROLE your_role_name; if it’s granted perms or other roles...

Read the latest Blogs

Forums

Why you should avoid Implicit Measures in your Power BI model

By Koen Verbeeck

Comments posted to this topic are about the item Why you should avoid Implicit...

Is it possible to create a parameter and use different datasets?

By Tamrak

Hello, I have an SSRS report, version 2019,  that has two parameters, which will...

Calculating Numerator and Denominator

By Reh23

Good evening, I have a rather peculiar issue while trying to calculate Numerator and...

Visit the forum

Question of the Day

The AG Synchronous Replicas

In a SQL Server 2022 Enterprise Edition AG, how many replicas can be configured with synchronous commit mode?

See possible answers