External Article

Script to calculate the Median value for SQL Server data

The standard SQL language has a number of aggregate functions like: SUM, MIN, MAX, AVG, but a common statistics function that SQL Server does not have is a built-in aggregate function for median. The median is the value that falls in the middle of a sorted resultset with equal parts that are smaller and equal parts that are greater. Since there is no built-in implementation for the median, the following is a simple solution I put together to find the median.

SQLServerCentral Editorial

Never offend a captive audience

Write what you choose to when the reader can, in turn, choose not to read your work; but when you are writing about Technology, you have a captive audience. They need to read your work to keep abreast of the technology. Don't gratuitously offend them. It is not the action of a gentleman, D____it!

SQLServerCentral Editorial

ETL

Today we have an editorial that was originally published on Aug 31, 2006 as Steve is traveling at DevConnections. It still seems relevant, so answer the poll this week.

Blogs

A New Word: los vidados

By

los vidados – n. the half-remembered acquaintances you knew years ago, who you might...

In-Person CISA Training – April 13-16, 2026

By

I will be leading an in-person Certified Information Systems Auditor (CISA) exam prep class...

EightKB 2026

By

EightKB is back again for 2026! The biggest online SQL Server internals conference is...

Read the latest Blogs

Forums

Vectors in SQL Server 2025

By Daniel Calbimonte

Comments posted to this topic are about the item Vectors in SQL Server 2025

Odd Sequences

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Odd Sequences

Everything is the right question away

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Everything is the right question...

Visit the forum

Question of the Day

Odd Sequences

What values are returned from this code?

CREATE SEQUENCE NumericSequence
    AS NUMERIC(5,1)
    START WITH 1.0
    INCREMENT BY 0.1;
GO
SELECT NEXT VALUE FOR NumericSequence
GO
SELECT NEXT VALUE FOR NumericSequence
GO

See possible answers