Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference between VARCHAR and CHAR

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
gvel19

New User


Joined: 20 Jul 2008
Posts: 19
Location: Schenactady, US

PostPosted: Wed Sep 24, 2008 12:14 pm    Post subject: Difference between VARCHAR and CHAR
Reply with quote

Hi,

We know that VARCHAR is a variable char and CHAR is a fixed char. If I declare CHAR(50) then 50 bytes will be allocated and used.
If I declare VARCHAR(50) and I'm giving the length as 10. Then only 10 bytes will be allocated and used.

Please correct me if i'm wrong.

Thanks,
Vel
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 24, 2008 2:06 pm    Post subject:
Reply with quote

according to the documentation, your interpretation is correct.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Wed Sep 24, 2008 7:01 pm    Post subject:
Reply with quote

VARCHAR does use two extra bytes to indicate the actual length, so 12 bytes would be used.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Only text from varchar Seppe DB2 8 Thu Apr 21, 2016 10:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us