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

Creating tables and queries

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

Postby Stargate38 » Sun Nov 01, 2015 9:17 pm

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   Expand viewCollapse view
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
Stargate38
 
Posts: 1
Joined: Sun Nov 01, 2015 8:39 pm

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

Postby Villeroy » Sun Nov 01, 2015 9:45 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28668
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 0 guests