Reputation: 373
I need to display int value in minimum 2 digit before decimal in sql server. Is it possible than how pls rply?
Upvotes: 0
Views: 1314
Reputation: 280383
While you really should be doing this formatting at the presentation layer, here is how to change 5
to 05
:
SELECT RIGHT('00' + CONVERT(VARCHAR(12), 5), 2);
In SQL Server 2012, you will be able to leverage the new FORMAT
function - much tidier and full .NET and culture support.
Upvotes: 2