All Forums Database
apolodor 4 posts Joined 04/12
04 May 2012
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

 

 

 

 

Sen_td 19 posts Joined 08/11
04 May 2012

Hi,

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

Thanks.

 

You must sign in to leave a comment.