How to truncate a value

  • Hi All,

    The following query produces "91.00000000%" value

    select CAST(ROUND((((971 - 90)/(971 * 1.0))

    * 100),0) AS VARCHAR) + '%'

    How do I truncate that value to "91.00%"

    Thanks.

  • SELECT CAST( CAST( ROUND((((971 - 90)/(971 * 1.0)) * 100),0) AS DECIMAL(9,2)) AS VARCHAR) + '%'

  • This type of formatting is better done in your front end application.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply