Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2006

Tip: Looking for answers? Try searching our database.

help needed for displaying a numeric value in a aprticular format..URGENT!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sangram_149@yahoo.com - 18 May 2006 08:15 GMT
hi,
i have a query which fetches the sum of amounts from a table .the
column is 19 bytes
but the query returns only the actual amount..for example ..it returns
..
-1245.00

but i want it to return all the 19 digits including the zeros and the
sign on the left
-000000000001245.00

plz tell me how this can be odne..its urgent
Raj - 18 May 2006 13:47 GMT
do this ...

select digits(c1) from t1

Raj
Gert van der Kooij - 18 May 2006 13:54 GMT
> do this ...
>
> select digits(c1) from t1

the digits function will strip of the negative sign. It can be added
with a case statement, something like this:
select case when c1 < 0 then '-' else ' ' end concat digits(c1) from t1
sangram_149@yahoo.com - 19 May 2006 06:55 GMT
thx dude.. but it removes the sign and the decimal point also ...is
there any other way this can be done...
p175 - 19 May 2006 07:30 GMT
What are you going to do with the result is I guess the question. You
could export it as a dec(19,2) which works fine, or convert it to a
char as in SELECT CHAR(DEC(SUM(C1),19,2)) FROM T1 if it is only going
to be displayed. If it's gonna be used numerically then I don't have an
answer I'm afraid.
--CELKO-- - 19 May 2006 15:59 GMT
>> but i want it to return all the 19 digits including the zeros and the sign on the left <<

What is the basic prinicple of a tiered architecture?  Display is done
in the front end and not in the database.  Someone was asleep in class
or really likes to use kludges.
Tony Rogerson - 19 May 2006 19:11 GMT
> >> but i want it to return all the 19 digits including the zeros and the sign on the left <<
>
> What is the basic prinicple of a tiered architecture?  Display is done
> in the front end and not in the database.  Someone was asleep in class
> or really likes to use kludges.

Wrong! Display is done where it is most efficient to do it, you need to
consider other scalability parameters - network bandwidth, client spec
etc...

See
http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/05/11/429.aspx
for a my opinion on this.

Who was asleep in the class on 'developing for a scalable
architecture', that was the class that had practical excercises rather
than just theory!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.