Retrieve the maximum length of a VARCHAR column in SQL Server

前端 未结 10 1769
时光说笑
时光说笑 2021-01-30 10:18

I want to find the longest VARCHAR in a specific column of a SQL Server table.

Here\'s an example:

ID = INT IDENTITY
DESC = VARCHAR(5000)

I         


        
10条回答
  •  甜味超标
    2021-01-30 10:35

    Gives the Max Count of record in table

    select max(len(Description))from Table_Name
    

    Gives Record Having Greater Count

    select Description from Table_Name group by Description having max(len(Description)) >27
    

    Hope helps someone.

提交回复
热议问题