Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Finding length of longest text column

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2009-02-23 : 06:41:20
How can I find length of the longest text entry for a given column please?

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-02-23 : 06:50:19
select max(len(column1)) from table1

Karthik
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-23 : 07:02:03
[code]SELECT MAX(DATALENGTH(COL)) FROM TABLE[/code]
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-23 : 07:13:15
I guess LEN won't work for text column.
Go to Top of Page

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-02-23 : 07:24:42
quote:
Originally posted by sodeep

I guess LEN won't work for text column.



Yes you are correct.


SELECT MAX(DATALENGTH(COLUMN1)) FROM TABLE1


Karthik
Go to Top of Page

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2009-02-24 : 02:05:34
Many thanks guys.
Go to Top of Page
   

- Advertisement -