SQL Server round the decimal data if decimal part is 0 -


in sql server stored procedure casting variable decimal:

cast( @tovalue decimal(38,5) ) 

if result 57282.0000 (decimal value 0 ) want appear 57282.

else want appear 57282.48300 example.

i cannot use float because if value greater 8 digit number, displayed exponential format.

how can solve this?

you should in formatting options reporting software.

if reason isn't possible following might work.

;with t(val) ( select 57282 union select 57282.48300 ) select case when 1= 0 null               when val = floor(val) cast(cast(val int)as sql_variant)              else cast(val decimal(38,5))             end t             

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -