You are using the terms 'record' and 'field' backwards.
A record has fields, therefore you would have 'longest field in a record.
If you table had the following fields - Name, Type, and Agerotia you would
use a union query like this first --
SELECT "Name" AS [Field], Len([Name]) AS [Size]
FROM YourTable
UNION ALL SELECT "Type" AS [Field], Len([Type]) AS [Size]
FROM YourTable
UNION ALL SELECT "Agerotia" AS [Field], Len([Agerotia]) AS [Size]
FROM YourTable;
select 'select ' + char(39) + sc.name + char(39) + ' as ColName, max
(Len(' + sc.name + ')) from tbl'
from syscolumns
where id = object_id('tbl')
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.