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 becomes 0023.
>
> Phillip
>
> On 6/19/07, Rick Root <[EMAIL PROTECTED]> wrote:
> > 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 is fine as long as the numbers are >= 100 or >=1000 (for the four
> > digit part).
> >
> > If not, I get results like this:  123.456.789 (where the last 4 digits
> > are actually 0789)
> >
> > Easy enough to deal with in Coldfusion using numberformat... but I
> > can't seem to find an equivalent Transact-SQL function, which
> > surprises me a bit.
> >
> > Is there a SQL solution for this?
> >
> > Rick

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281597
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to