Re: OT: Transact-SQL number formatting

2007-06-20 Thread Rick Root
Phillip, that worked great, thanks! On 6/19/07, Phillip Ciske <[EMAIL PROTECTED]> wrote: > T-SQL has a replicate() function that can help. You can pad the last > four digits with zeros using: > > REPLICATE('0', 4 - LEN(h.phonenbr)) + CAST(h.phonenbr AS varchar) > > So 789 becomes 0789 and 23 becom

Re: OT: Transact-SQL number formatting

2007-06-19 Thread Phillip Ciske
T-SQL has a replicate() function that can help. You can pad the last four digits with zeros using: REPLICATE('0', 4 - LEN(h.phonenbr)) + CAST(h.phonenbr AS varchar) So 789 becomes 0789 and 23 becomes 0023. Phillip On 6/19/07, Rick Root <[EMAIL PROTECTED]> wrote: > I'm accessing some mainframe d

OT: Transact-SQL number formatting

2007-06-19 Thread Rick Root
I'm accessing some mainframe data where phone number parts are stored as integers. i'm trying to return it as a single formatted number so I did this: CAST(H.AREACODE AS VARCHAR)+'.'+CAST(H.PHONEXCH AS VARCHAR)+'.'+CAST(H.PHONENBR AS VARCHAR) AS PHONE_NUMBER, which returns "123.456.7890" This i