T-SQL

SQLServerCentral Article

The COUNT Function in T-SQL

  • Article

The COUNT function is among the most used functions in the T-SQL codes. Even though COUNT is easy to use, it should be used carefully because it could often not return the desired result. For the big tables, the counting of the rows could cause blocking as well as take some more time.

(47)

You rated this post out of 5. Change rating

2018-02-09 (first published: )

10,981 reads

Blogs

A Cloud Dependency Failure from Amazon

By

I went to sleep while reading a Kindle book on my phone. I know...

Deploying AI in logistics (the unfiltered version)

By

A conversation with Jan Laš, CIO at HOPI, about what deploying a data agent...

T-SQL Tuesday #198 Invitation: How Do You Detect Data Changes?

By

It's time for T-SQL Tuesday #198! This month's topic is change detection. The post T-SQL...

Read the latest Blogs

Forums

BCA KCP Dewi Sartika Telp/WA.0821°3111°179

By Simon Hammill

Telp/WA.0821°3111°179 Jl. Dewi Sartika No.189, RT.1/RW.5, Wil, Kec. Kramat jati, Kota Jakarta Timur, Daerah...

BCA KCP Cipondoh Telp/WA.0821°3111°179

By Simon Hammill

Telp/WA.0821°3111°179 Jl. KH. Hasyim Ashari Km. 1,5 Blok C-D, RT.002/RW.003, Poris Plawad Indah, Kec....

SPAM Issues May 2026

By Steve Jones - SSC Editor

We suffered a SPAM attack from May 1-6, which unfortunately corresponded with time off...

Visit the forum

Question of the Day

Creating a JSON Document III

I have this data in a table called dbo.NFLTeams

TeamID  TeamName       City             YearEstablished
------  --------       ----             ---------------
1       Cowboys        Dallas           1960
2       Eagles         Philadelphia     1933
3       Packers        Green Bay        1919
4       Chiefs         Kansas City      1960
5       49ers          San Francisco    1946
6       Broncos        Denver           1960
7       Seahawks       Seattle          1976
8       Patriots       New England      1960
If I run this code, how many rows are returned?
SELECT TOP 2 
  json_objectagg('Team' : TeamName)
FROM dbo.NFLTeams;

See possible answers