Negtive money values

  • Hi I have this (simplified, reduced) code from a SP:

    declare @amount decimal(8,2),

    @Amt_2 money,

    @Amt_1 money

    set @Amt_1 = -1.00

    set @Amt_2 = -.35

    set @amount = -.70

    Does anybody know why, when debugging, the value in the locals window is a positive value for @Amt_2 even though I am assigning a negative value?. It returns properly from SP, but is frustrating while debugging values. @Amt_1 and @amount display correctly.

    Thanks, Greg

  • rather than using a "cast" in your print statement, use a STR function.

     

     



    A.J.
    DBA with an attitude

  • Bizarre!  You get warnings when debugging SQL Server running under localSystem account - could this be one of the possible side effects?  Try changing MSSQLSERVER service to run under a user account and see if this makes a difference?  At least the return value is correct!   You could create a varchar variable and cast the money value to it and inspect the varchar value instead?

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

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