Ask Your Question
0

How to determine the format of a field in a table using sql?

asked 2017-07-24 21:44:29 +0200

Quarto Die gravatar image

updated 2017-07-24 21:44:57 +0200

I am attempting to create a table using sql. I want the "dollars" field to show up as currency in this format: $0.00. Using the the following command I can only get the format without the dollar sign.

CREATE TABLE "mytable3" ("id" INTEGER PRIMARY KEY, "dollars" NUMERIC (10,2))

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-07-24 22:41:11 +0200

Ratslinger gravatar image

Using SQL sets the internal DB format of the field. What you are looking for is the display format of the field.

Now normally you can just edit the table and change the field format. However, based upon previous questions (and you should have stated here) you have a split DB so you cannot edit table fields.

To change the display format in a split DB, view the table. Right click the column heading you want to modify and select Column format.... Then choose the format you wish to display - in your case Currency. when completed make sure you save the changes - will be indicated on main .odb form. Will display in your format from that point on.

edit flag offensive delete link more

Comments

I am really trying to create new tables (over and over again) with a column immediately with that format i.e. currency and put it in a macro I can use by the click of a button. But your answer seems to indicate that it is not possible to do this using sql which concords with its lack of presence in the sql manual.
Thank you for your tip on right clicking the column, and bringing up column format, however as I have do the operation several times in an automated way, it is not what I hoped for.

Quarto Die gravatar imageQuarto Die ( 2017-07-25 05:52:18 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-07-24 21:44:29 +0200

Seen: 48 times

Last updated: Jul 24 '17