By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

May 18 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Raj
do this ...

select digits(c1) from t1

Raj

May 18 '06 #2

P: n/a
In article <11**********************@j33g2000cwa.googlegroups .com>,
sp****@yahoo.com says...
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
May 18 '06 #3

P: n/a
thx dude.. but it removes the sign and the decimal point also ...is
there any other way this can be done...

May 19 '06 #4

P: n/a
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.

May 19 '06 #5

P: n/a
>> 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.

May 19 '06 #6

P: n/a

--CELKO-- wrote:
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/tonyro...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!

May 19 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.