Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

MAX (Transact-SQL)

Returns the maximum value in the expression. May be followed by the OVER clause.

Topic link iconTransact-SQL Syntax Conventions

MAX ( [ ALL | DISTINCT ] expression )


Applies the aggregate function to all values. ALL is the default.


Specifies that each unique value is considered. DISTINCT is not meaningful with MAX and is available for ISO compatibility only.


Is a constant, column name, or function, and any combination of arithmetic, bitwise, and string operators. MAX can be used with numeric, character, and datetime columns, but not with bit columns. Aggregate functions and subqueries are not permitted.

For more information, see Expressions (Transact-SQL).

Returns a value same as expression.

MAX ignores any null values.

For character columns, MAX finds the highest value in the collating sequence.

The following example returns the highest (maximum) tax rate.

USE AdventureWorks;
FROM Sales.SalesTaxRate;

Here is the result set.


(1 row(s) affected)

Warning, null value eliminated from aggregate.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft