Decimal to Varchar Issue


Decimal to Varchar Issue

I have a Decimal column (DECIMAL 6,0) which is loaded to a Varchar column in a different table using TSQL.

TD 13 is adding an extra character at the end of the value; e.g:

12356 -> 12356.

450 -> 450.

I could apply a substring function on it to remove the last character but first I want to find out if it is normal to have such issue.

Thank you


Re: Decimal to Varchar Issue


You can cast it as integer or bigint to avoid those '.'. Make sure you are not missing precision values.

sel cast(cast('12356' as decimal(10,0)) as varchar(20)) ; ----> 12356.

sel cast (cast(cast('12356' as decimal(10,0)) as bigint)as varchar(20)) ; -----> 12356