Is there an easy way to format SQL Server numeric(18,6) data type to format similar to c#’s {0:#.00####} but in T-SQL?
E.g.
- 12.550000 should produce 12.55.
- 14.456700 should produce 14.4567.
- 15.00 should produce 15.00.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As HLGEM says, it’s best to do this kind of stuff on the front end, but for kicks, the following code seems to work. There’s probably a better way to do it though.