Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi all,
I have a datatable objdt, with multiple columns as tid, name, city, country.

I want max tid length, max name length ......
from objdt datatable.

How can I do it?


Thanks in advance.
Posted
Updated 29-Nov-10 1:45am
v2

You could use a variation of the following.. (my syntax may not be entirely correct as I didn't have time to check it out in management studio)

SQL
SELECT  MAX(len(tid)), 
        MAX(len(name)), 
        MAX(len(city)), 
        MAX(len(country))
  FROM  objdt
 
Share this answer
 
v3
Comments
Henry Minute 29-Nov-10 7:49am    
Dang it, PogoboyKramer... You beat me to it this time... :)
If you had done even a rudimentary search, you might have found threads like this[^] one.
 
Share this answer
 
Comments
Ed Gadziemski 13-Jul-11 1:36am    
And had you done even a rudimentary perusal of the OP's question, you might have found he was asking about DataTable objects, not about SQL Server. D'oh.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900