sql - How to preserve decimal precision in stored procedure? -


i have column datatype decimal(10,2) in table , when try update column in stored procedure losing 2 digit precision.

if update field single query, works fine, in stored procedure loses precision.

example:

update table set decimal(10,2) column = decimal(10, 2) column / 100 

example: 197.50 when updated results in 197.00

thanks

i think, in rdmbs run-time conversion automatically done on column / 100 that:

  • column in decimal format and
  • 100 not in decimal format

so solution changing 100 decimal format 1 of these:

  • 100.00
  • cast(100 decimal(10, 2))
  • (decimal(10, 2) 100)

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -