I have a table with one of the columns is of type varchar(city). and want to find the longest and shortest of values stored in that column.
select a.city, a.city
select top(1) city, max(len(city)) [Length] from station group by city order by [Length] select top(1) city, max(len(city)) [Length] from station group by city order by [Length] DESC
Tested in SQL Server 2016