Question : How to Convert a Money field to Decimal in a Sybase Stored Procedure

I am writing a Sybase Stored Procedure and I need to accomplish the following;

1. Convert a Money field to Char or Decimal whatever is best for an Amt and strip the implicit Decimal  point.
    End result would be 25.00 to 0002500, 8.50 to 0000850 etc.....  
2. Add leading zeroes since this is an amt.
3. Convert the last character to an A if 0, B if 1, C if 2, D if 3, E if 4 etc....

I converted it to character but it left the implicit decimal point  

Answer : How to Convert a Money field to Decimal in a Sybase Stored Procedure

That isn't the full expression, look at the last line of code in my answer above:

right("00000000" + convert(char(8), convert(int, amount * 100)), 8)

That says add more zeroes than you need, but take only the right 8-most characters. This will get rid of the "excess" leading zeroes.

If you want a char(11), then use right(..., 11).
Random Solutions  
 
programming4us programming4us