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.
Author |
Topic |
mrkbwn
Starting Member
4 Posts |
Posted - 2007-03-21 : 10:22:23
|
How would I go about testing the record set for the longest record and the shortest record? total number of all character in all feilds for a record.Also, is there any way to count the number of characters in a feild and show which one is the longest and which one is the shortest. For example. A field that contains names. I would like to find the record for which name uses the most characters, and the record that shows the least number of characters. Its for an address block on a mailer that must fit in a windowed envolope. any direction would be great.mrkbwn |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-21 : 10:25:34
|
SELECT MAX(LEN(Field1)), MIN(LEN(Field1))FROM Table1Peter LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-21 : 10:27:25
|
SELECT TOP 1 * FROM Table1ORDER BY LEN(Name)SELECT TOP 1 * FROM Table1ORDER BY LEN(Name) DESCPeter LarssonHelsingborg, Sweden |
 |
|
mrkbwn
Starting Member
4 Posts |
Posted - 2007-03-21 : 11:24:11
|
PESO,You Rock! Thanks Again.mrk |
 |
|
|
|
|