Home > Archive > SQL Anywhere database > December 2005 > How to format a string in sql itself...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to format a string in sql itself...
Karthik

2005-12-19, 8:24 pm

Hi All,

I would like to know in ASA, is there anyway that we can format
the string in the sql itself. For example, I want to format the 23230.40 as
$23,230.40 and 5619993829 as (561) 999-3829 etc.

Thanks in advance
Karthik


Paul Horan[TeamSybase]

2005-12-20, 3:23 am

Output formatting is typically a task for the front-end presentation layer.
However, you could certainly achieve what you want with clever use of the
SUBSTR() function and string concatenation...

Paul Horan[TeamSybase]

"Karthik" <kpanc@laborfinders.com> wrote in message
news:43a73419$1@foru
ms-1-dub...
> Hi All,
>
> I would like to know in ASA, is there anyway that we can format
> the string in the sql itself. For example, I want to format the 23230.40
> as $23,230.40 and 5619993829 as (561) 999-3829 etc.
>
> Thanks in advance
> Karthik
>



Pavel Karady

2005-12-20, 3:23 am

Formatting the string within SQL is a classic thing to do. There are many
functions intended to string formatting in ASA - see:

ASA Adaptive Serve Anywhere Reference Manual
CHAPTER 8. SQL Functions
Function types
String functions

I surely recommend the concatenation function as well (the || mark), if you
aren't aware of it yet.

Pavel


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com