Page 1 of 1

Maximum length of a varchar field

Posted: Thu Sep 30, 2010 3:22 pm
by somu_june
Hi ,

I have a file created by a server job with data type integer(10) and while I'm designing a parallel job I mentioned it as varchar(255), my question is what is the maximum varchar length I can give in datastage. Because when ever I import a meta data it gives me varchar(255) , is varchar(255) maximum or I can define varchar(1023) for integer(10) field.



Thanks,
Raju

Posted: Thu Sep 30, 2010 4:14 pm
by ray.wurlod
Because text files don't have data types (other than "text") VarChar(255) is used as a default. DataStage has a really high limit on length of a VarChar (64K ?); however some databases limit it (for example to 1024) making you use Long VarChar for anything larger.

Posted: Fri Oct 01, 2010 7:48 am
by somu_june
Thanks ray for the reply. If I don't provide any length to the varchar field in datastage, what is the maximum it takes is it ( 255 ) or is it going to read entire data from the column as you said it is a text field with out trimming or dropping any data from the column.


Thanks,
Raju

Posted: Fri Oct 01, 2010 7:54 am
by kandyshandy
it will not drop any data i.e. it will read entire column data. Best way is to try it out ;)

Posted: Fri Oct 01, 2010 8:25 am
by somu_june
Thanks Kandy/sandy and Ray , I tested the job and if I don't provide any length to varchar field it reads the entire column data.



Thanks,
Raju

Posted: Fri Oct 01, 2010 4:20 pm
by ray.wurlod
This is what's called an "unbounded VarChar".

These have a specific storage strategy in Data Sets, which ordinarily store data (even bounded VarChar) in fixed width format, because it's far more efficient to pack and unpack.