|
-
May 19th, 2004, 08:34 AM
#1
Thread Starter
Frenzied Member
get max field length [Resolved]
Is there a way to get the width of the longest value in a particular field? I'm spilling all the contents of a table out onto a web page and I want to make the fields wide enough to handle the biggest value in that particular field.
DB: SQL Server 2000
Language: PHP
Last edited by ober0330; May 19th, 2004 at 12:00 PM.
-
May 19th, 2004, 08:47 AM
#2
Frenzied Member
Code:
SELECT *
FROM Information_Schema.Columns
WHERE TABLE_NAME = 'TableName'
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
May 19th, 2004, 09:13 AM
#3
Thread Starter
Frenzied Member
That returns the maximum allowed. I'm looking for the actual max length existing in the column.
Example: Column x is a nvarchar field that can hold something 75 characters long. The longest actual entry is only 47 characters long. I want the 47 value.
-
May 19th, 2004, 10:04 AM
#4
Fanatic Member
Code:
Select Max(Len(x))
From TableA
Chris
Master Of My Domain
Got A Question? Look Here First
-
May 19th, 2004, 12:00 PM
#5
Thread Starter
Frenzied Member
Perfect!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|