Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there any data type of just right length?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all
Is there any data type which takes only that space which is the actual data.

For example if i reserve a field like varchar(50) for storing a address and some address only uses 25 character than all empty space will be wasted.


Is there any solution of this problem.?or is there any variable length field.?

I am using MySQL .

 
Hiya,

You are using the correct data type for variable length information.....

CHAR(50) will always use 50 characters, for example, if the field contains the word "ALL", it will then be padded with 47 spaces

VARCHAR(50) will use between 0 and 50 characters. If a varchar field contains the word "ALL", it will use just 3 characters of space in the database.

Hope this is clear,

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top