Home T-SQL Set float to fix precision
Reply: 0

T-SQL Set float to fix precision

Kolling Master
Kolling Master Published in 2017-12-06 15:12:12Z

Is it possible to get a variable type of a numeric to this: 123321.00 Float converts to 123321, but I need 123321.00 Since cast(@v as decimal(18,@p)) is not possible (where @p is type of tinyint, for ex. 2), I did it like this:

CAST(ROUND(CAST(REPLACE(FORMAT(123321.00001, 'N2'), ',', '') as decimal(18,8)), 2) as float(2))

But this outputs the same: 123321.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302712 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO