I cannot get the syntax for RTrim(Total)

  • I know how to use round and convert(demical(10,2),TOTAL) TO FORMAT THE MONEY DATA TYPE TO 2 NUMBERS LEFT of the decimals but wanted to try RTrim with no luck. Caps Lock on accident, I am not shouting.

     

    my best guess for RTrim in T-sql is (of this does not work)

    RTrim(ActionAmus.Location,2)

    what is wrong with my syntax here??

    thanks

  • As per Books Online, the RTRIM  function "Returns a character string after truncating all trailing blanks" therefore it's totally different functionality to ROUND and CONVERT.

     

    --------------------
    Colt 45 - the original point and click interface

  • right - all the "trims" are string functions to trim the leading/trailing blanks/spaces...

    you could use "select cast(Total as decimal(10,2))" though...which works just like "convert" (except for formatting) AND is ansi compliant...







    **ASCII stupid question, get a stupid ANSI !!!**

  • from what I see, you are trying to use the RTrim function as you would use the RIGHT function.  The function RTrim requires no secondary argument.  RTrim('This String   ') will yield 'This String'.  The function RIGHT('ThisLocation',2) will yield 'on'.  It will return only the right two characters of the string.  Both of the above are string functions and must be used on strings to avoid error.

    Kindest Regards,
    David

    ** Obstacles are those frightening things that appear when we take our eyes off the goal. **

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

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