Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display 2 decimal places

Status
Not open for further replies.

bslaast

MIS
Oct 22, 2009
46
US
I want to display 2 decmial places

I currently have:

LPAD(t.full_curr_amount,10,'0')

t.full_curr_amount is a number.
 
I cannot find LPAD anywhere in the T-SQL BOL. I'm on SQL Server 2005 - what does LPAD do?

Beir bua agus beannacht!
 
LPAD() adds the first character in the list to the left side of a string until the string is the specified length.


Examples

LPAD("APPLES", 10, ".") = "....APPLES"

LPAD("APPLES", 10) = " APPLES"

LPAD("APPLES", 3) = "APP"
 
try...

LPAD([!]Convert(Decimal(10,2), [/!]t.full_curr_amount[!])[/!],10,'0')

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Pardon the ignorance, but are you sure you have the correct form? This is Transact SQL for SQL Server. I did find this at the MS SQL Server help site:
Unfortunately T-SQL does not offer functions like Oracle PL/SQL's LPAD() and RPAD() and C#'s PadLeft() and PadRight() functions.

Just curious. Geoge's solution works fine in T-SQL, but may not work in Oracle, if that is what you are using.

Beir bua agus beannacht!
 
Oops - that's forum, not "form".

Beir bua agus beannacht!
 
Pardon MY ignorance, you are right... I'm using oracle.
 
In my defense... I thought LPAD might have been a user defined function. [blush]

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Genomon - thanks, learned something new related to Oracle. May be you can also tell me if we have ROW_NUMBER() function in Oracle? There was a question in MSDN, but I was lazy to search.

PluralSight Learning Library
 
Sorry - don't use Oracle. Just got lucky with a related search at MSDN.

Beir bua agus beannacht!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top