• I would personally format the data in the front end tool as you are more likley to have better functions (pre 2012) to handle this, such as the vb/c#/RS, FORMAT function.

    As a QUICK fix you change the code to do an ABS on the covert from money to String. Then Use a CASE SIGN(@Amount) WHEN -1 THEN '-' END to add in the negative on the return (see below)

    (I also made a change to use SET rather than SELECT out of personal preference)

    CREATE function [dbo].[Fn_Indian_Money_Format]

    (

    @amount MONEY

    )

    RETURNS VARCHAR(50)

    AS

    BEGIN

    DECLARE @charMoney VARCHAR(50), @RemainingChar VARCHAR(50), @QuoteChar VARCHAR(50)

    DECLARE @LenStr INT, @val INT, @index INT

    Set @charMoney = CONVERT(VARCHAR(50),ABS(@amount))

    Set @QuoteChar = SUBSTRING(@charMoney,1,CHARINDEX('.',@charMoney)-1)

    Set @val = LEN(@charMoney) - LEN(@QuoteChar)

    Set @RemainingChar = SUBSTRING(@charMoney,CHARINDEX('.',@charMoney),@val)

    Set @LenStr = LEN(@QuoteChar)

    SET @index = 3

    WHILE (@LenStr > @index)

    BEGIN

    SET @QuoteChar = (SELECT STUFF(@QuoteChar, (@LenStr-@index) + 1, 0, ','))

    SET @index = @index + 2

    END

    RETURN CASE SIGN(@amount) When -1 then '-' END+ isnull(left(@QuoteChar + @RemainingChar, len(@QuoteChar) + len(@RemainingChar)-3),0)

    END

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices