[Solved] How to change field type of an existing column?

Creating tables and queries
Post Reply
Stargate38
Posts: 1
Joined: Sun Nov 01, 2015 8:39 pm

[Solved] How to change field type of an existing column?

Post by Stargate38 »

I'm new to Base, and I accidentally used the wrong field type in my "Phone_Number" Column, meaning I can't put more than 10 digits in. How do I change the field type of that column, so that I can put 11 digit numbers in it? I tried right-clicking on the column and all I got was "Column Format", "Column Width", and "Hide Column". I can't find anything in the help file about it, and Googling the problem comes up with nothing.

Here's the error I get when trying to type in a toll-free 1-800 number, after hitting Enter:

Code: Select all

SQL Status: 22001
Error code: -124

Value too long in statement [UPDATE "Phone Numbers" SET "Phone_Number" = ? WHERE "ID" = ?]
That doesn't come up if I omit the 1 (i.e. 8001234567 instead of 18001234567).
Last edited by Stargate38 on Sun Nov 01, 2015 11:46 pm, edited 1 time in total.
Apache OpenOffice 4.1.1 AOO411m6(Build:9775) - Rev. 1617669; 2014-08-13 09:06:54 (Mi, 13 Aug 2014)
OS: Windows 7 64-bit; 6 GB RAM; 450 GB HDD; CPU: Intel Core i3-3110M
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to change field type of an existing column?

Post by Villeroy »

menu:Tools>SQL...
ALTER TABLE "Phone Numbers" ALTER COLUMN "Phone Number" VARCHAR(20);
menu:View>RefreshTables
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply