Aggregate Functions and Datatypes

You can use the aggregate functions with any type of column, with a few exceptions.

The exceptions are:

For example, you can use min (minimum) to find the lowest value—the one closest to the beginning of the alphabet—in a character type column:

select min(au_lname) 
from authors 
-------------------------- 
Bennet 
 
(1 row affected) 

However, you cannot average the contents of a text column:

select avg(au_lname) 
from authors 
Msg 257, Level 16, State 1:
-------------------------- 
(1 row affected) 
Line 1:
Implicit conversion from datatype ’VARCHAR’ to ’INT’ is not allowed.  Use the CONVERT function to run this query.