472,780 Members | 1,224 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 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 5071
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: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.