View previous topic :: View next topic |
Author |
Message |
sonika2008 Beginner
Joined: 17 Aug 2007 Posts: 20 Topics: 9
|
Posted: Mon Oct 08, 2007 9:53 am Post subject: How to find the min and max varchar field size in db2 table? |
|
|
I have a varchar field in table. I wanted to know the minimum and maximum size for varchar filed, the MIN and MAX function can only use for the numeric data type. Is there any function from which i can find the length for varchar , in table i have millions of records. |
|
Back to top |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Mon Oct 08, 2007 10:23 am Post subject: |
|
|
Not sure what the problem is. The MIN/MAX aggregate functions can be used for any column type. For lengths, you just nest the MIN/MAX aggregate functions and the LENGTH scalar function.
Code: |
SELECT MIN(LENGTH(VARCHAR_COL_A)),MAX(LENGTH(VARCHAR_COL_A))
FROM TBL
|
Hope that's what you're looking for. |
|
Back to top |
|
|
sonika2008 Beginner
Joined: 17 Aug 2007 Posts: 20 Topics: 9
|
Posted: Mon Oct 08, 2007 10:34 am Post subject: |
|
|
Thanks for your quick response!!
Its working fine. |
|
Back to top |
|
|
|
|