Blog Posts

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,088 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,855 reads

Blogs

Learn about Modern Microsoft Apps in San Diego

By

I wrote about learning today for the editorial: I Can’t Make You Learn. I...

How To Deploy Fabric SQL and Azure SQL Databases with Azure DevOps

By

Fabric has CI/CD built in, but if you've tried to use it for database...

A New Word: Attriage

By

attriage – n. the state of having lost all control over how you feel...

Read the latest Blogs

Forums

ALAMAT BCA KCU BENGKULU TLP/WA 08218154374

By R4nt4u

Hub Cs:08218154374 Jl. S. Parman No.66, Kebun Kenanga, Kec. Ratu Agung, Kota Bengkulu, Bengkulu...

ALAMAT BCA KCU BUKITTINGGI TLP/WA 08218154374

By layanan_Bca88

Hub Cs:08218154374 Jl. Sudirman No.59, Bukit Cangang Kayu Ramang, Kec. Guguk Panjang, Kota Bukittinggi,...

ALAMAT KANTOR BCA KCU PADANG TLP/WA 08218154374

By m4rt1n4

Hub Cs:08218154374 Jl. H. Agus Salim No.10 A, Sawahan, Kec. Padang Tim., Kota Padang,...

Visit the forum

Question of the Day

BIT_COUNT II

In SQL Server 2025, I have a table (dbo.UserPermission) that contains this data:

UserID  UserPermissions
15
23
37
4       NULL
What is returned when I run this code:
select bit_count(UserPermissions) as PermissionCount
from dbo.UserPermission
where UserID = 4;

See possible answers