When you CAST a non-string type to a string type, SQL standard expects that the resultant string value represent the original data type.
For example if you were to type
SELECT 1 C1, 1.5 C2 , 7.77e0 C3 from ....
C1 would imply an integer literal where based on the precision of the number the vendor will pick an appropriate integer type
C2 would imply a precise numeric type (i.e decimal) whose precision (p) and scale (s) is derived from the value
C3 is an approximate number (i.e double, real etc)
Hence, when you CAST ( C3 as varchar(9)) you get a string representation of an approximate numeric type.
Note, if you CAST( CAST ( as DECIMAL (P,S)) as VARCHAR(n)) you will get a precise decimal literal value.
Keep in mind, this also means trailing zeroes will be included in the literal based on the P,S of the decimal.
------------------------------
NIGEL CAMPBELL
------------------------------