473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Turn off "money" formatting?

Is it possible to turn off the "$" and "," that appear in "money" formatted
columns so I can dump the table in a numeric format?

The man page hints that lc_monetary controls the formatting but I
cannot find any clues on what to do...

Apparently money cannot be cast to anything.

I don't think it will be hard to write a custom tcl/perl
script that takes a "copy checks to...." command to do the task
but I would like a cleaner solution....
Jerry
Nov 23 '05 #1
4 5113
If you need to be able to cast money to numeric, you can just write your
own cast. This is one of the things about postgres that I dearly love.

You could probably even write the cast function in SQL using regular
expressions.

Then, you just write a query with an explicit cast, e.g. SELECT foo ::
numeric FROM bar;

I noticed in the docs that the money type is actually deprecated, so you
probably want to consider converting your column to the numeric type
regardless.

BJ

Jerry wrote:
Is it possible to turn off the "$" and "," that appear in "money" formatted
columns so I can dump the table in a numeric format?

The man page hints that lc_monetary controls the formatting but I
cannot find any clues on what to do...

Apparently money cannot be cast to anything.

I don't think it will be hard to write a custom tcl/perl
script that takes a "copy checks to...." command to do the task
but I would like a cleaner solution....
Jerry

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
If you need to be able to cast money to numeric, you can just write your
own cast. This is one of the things about postgres that I dearly love.

You could probably even write the cast function in SQL using regular
expressions.

Then, you just write a query with an explicit cast, e.g. SELECT foo ::
numeric FROM bar;

I noticed in the docs that the money type is actually deprecated, so you
probably want to consider converting your column to the numeric type
regardless.

BJ

Jerry wrote:
Is it possible to turn off the "$" and "," that appear in "money" formatted
columns so I can dump the table in a numeric format?

The man page hints that lc_monetary controls the formatting but I
cannot find any clues on what to do...

Apparently money cannot be cast to anything.

I don't think it will be hard to write a custom tcl/perl
script that takes a "copy checks to...." command to do the task
but I would like a cleaner solution....
Jerry

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3
On Sun, Jun 06, 2004 at 01:44:26PM -0700, Jerry wrote:
Is it possible to turn off the "$" and "," that appear in "money" formatted
columns so I can dump the table in a numeric format?


Don't use "money" datetype. You can use other numerical datetype and
currency symbol add to final result when you need it. For example you
can use "numeric" and to_char(.., '999L') for result formatting.

I think a lot of things about "money" you found in PostgreSQL lists
archives.

.. and .. Please, read docs:

http://developer.postgresql.org/docs...ype-money.html

Note: The money type is deprecated. Use numeric or decimal
instead, in combination with the to_char function.

:-)
Karel

--
Karel Zak <za***@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #4
On Sun, Jun 06, 2004 at 01:44:26PM -0700, Jerry wrote:
Is it possible to turn off the "$" and "," that appear in "money" formatted
columns so I can dump the table in a numeric format?


Don't use "money" datetype. You can use other numerical datetype and
currency symbol add to final result when you need it. For example you
can use "numeric" and to_char(.., '999L') for result formatting.

I think a lot of things about "money" you found in PostgreSQL lists
archives.

.. and .. Please, read docs:

http://developer.postgresql.org/docs...ype-money.html

Note: The money type is deprecated. Use numeric or decimal
instead, in combination with the to_char function.

:-)
Karel

--
Karel Zak <za***@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chumley the Walrus | last post by:
I'm trying to insert a value into sql dbase, the value "amount" is a money datatype (currency). Below is the parameter for the "amount" value: cmd.Parameters.Add(New SQLParameter("@amount",...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
11
by: David | last post by:
Comments on a program called PHP Page Generator? ( http://www.phppagegenerator.com) I received a email offer of $100 and the product appears to allow quick generation of code for SQL web...
1
by: Stephane Charette | last post by:
QUICK VERSION: How do I create an index on a field of type "MONEY"? ----------------------------- LONG VERSION: I have a table with a field of type "money". I very often need to access...
0
by: Jerry | last post by:
Is it possible to turn off the "$" and "," that appear in "money" formatted columns so I can dump the table in a numeric format? The man page hints that lc_monetary controls the formatting but I...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
2
by: Randy Smith | last post by:
Hi, Does anyone have any good techniques on how to convert an SQL Server 2005 "money" datatype into the ASP.Net "double" datatype? OR, should we be using "decimal" at both ends? TIA, Randy...
1
by: jonesgirl620 | last post by:
I want to select a filed that is declared as money and have the output of that select statement be decial point free. Do I use Cast?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.