Home Forums SQL Server 7,2000 T-SQL Need to display decimal value converting it to non decimal 13 character numeric string replacing unused character positions with ''0'' RE: Need to display decimal value converting it to non decimal 13 character numeric string replacing unused character positions with ''''0''''

  • This would normally be handled client side but what the heck :

     

    DECLARE @n AS Decimal(18,2)

    SET @n = 150

    SELECT RIGHT(REPLICATE('0', 13) + CONVERT(VARCHAR(15), @n), 13)