Home All Groups Group Topic Archive Search About

Eleminate trailing zeros in the numeric field

Author
29 Jun 2006 8:12 AM
Subbaiah
Hello,

I have a numeric field with 4 decimal places.
In the select query i want to eliminate trailing zeros.

      DB Value Result
      1.1234 1.1234
      1.1230 1.123
      1.1200 1.12
      1.1000 1.1
      1.0000 1


Thanks in advance.

M. Subbaiah

Author
29 Jun 2006 9:22 AM
ML
What you want to do is formatting a string. In order to do that you need to
CAST the value to a character data type. Do you really want to do that?

Anyway, here's a nice article on casting and converting data in SQL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2f3o.asp

Look at the style parameter.


ML

---
http://milambda.blogspot.com/

AddThis Social Bookmark Button