Hi All,
I have a VARCHAR column in a DB2 table. I'm trying to know the minimum and maximum size this varchar filed can store. I tried using the MIN and MAX function but they can only be used for the numeric data type. Is there any function with which I can find the length for varchar, please help.
How to get the min and max varchar field size in DB2 table?
-
- New Member
- Posts: 8
- Joined: Thu Jul 31, 2014 11:33 am
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: How to get the min and max varchar field size in DB2 tab
Hi,
MIN/MAX should have worked for you, try this:
MIN/MAX should have worked for you, try this:
Code: Select all
SELECT MIN(LENGTH(VARCHAR_COL_A)),MAX(LENGTH(VARCHAR_COL_A))
FROM TABLE_NAME
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- New Member
- Posts: 8
- Joined: Thu Jul 31, 2014 11:33 am
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: How to get the min and max varchar field size in DB2 tab
You're welcome! 

Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute