MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to find the min and max varchar field size in db2 table?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sonika2008
Beginner


Joined: 17 Aug 2007
Posts: 20
Topics: 9

PostPosted: Mon Oct 08, 2007 9:53 am    Post subject: How to find the min and max varchar field size in db2 table? Reply with quote

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
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Mon Oct 08, 2007 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message
sonika2008
Beginner


Joined: 17 Aug 2007
Posts: 20
Topics: 9

PostPosted: Mon Oct 08, 2007 10:34 am    Post subject: Reply with quote

Thanks for your quick response!!
Its working fine.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group