Page 1 of 1

Special Character in Char column

Posted: Wed Aug 23, 2006 8:45 pm
by keshav0307
I have teradata table which has a column of type char(30), and in my job i have a transform just before inserting into this Teradata table. i am passing a value 'RSH_PROD_DTL' into this column, but when i query select * from <table_name> where <column_name>= 'RSH_PROD_DTL' ; it returns nothing and when i say select * from <table_name> where <column_name> Like 'RSH_PROD_DTL%' ; it returns the desired records. so i tthink there is some special charater inserted for rest of the space in column, can anyone suggest please how to handle this.

Posted: Wed Aug 23, 2006 9:39 pm
by DSguru2B
Your inserted value is of length 12. The column is defined as char(30), so the database adds spaces to honor the length of the column. Thats why you are not able to select without using the 'like' operand.

Posted: Thu Aug 24, 2006 12:29 am
by ray.wurlod
Yes, Char fields are padded. The default pad character is set with an environment variable (APT_DEFAULT_STRING_PADCHAR if I remember correctly), but can be overridden down to the individual column level. Right click on the column in the Columns grid to open the editor and find the pad character property.

The default default value is \x00 (the ASCII "NUL" character). You can specify the space character as a space, as \040 (octal representation) or \x20 (hexadecimal representation).

Posted: Fri Aug 25, 2006 5:22 am
by keshav0307
Thanks Ray. It worked