Page 1 of 1

Adding a column to an existing database

Posted: Sat Feb 09, 2019 3:35 pm
by baxtec
I have an existing database with over 1000 entries. I now need to add a further column to the database but I cannot find any way of doing this. I have got round the immediate problem by saving the database as a spreadsheet and manipulating that - but of course it doesn't give me all the functionality of a database.
Is there any way of modifying the database please?

Re: Adding a column to an existing database

Posted: Sat Feb 09, 2019 5:55 pm
by UnklDonald418
Look in the lower left corner of the main database window. If you are using an Embedded database connection you have two options.
In the Tables area of the main database window right click on the table name and select Edit to open the table design GUI.

The following should work with Embedded and most other connection types
Select Tools>SQL, enter and execute a command in the following format

Code: Select all

ALTER TABLE "Table Name" ADD COLUMN "Column Name" [Data Type] [Optional Constraint];
for example

Code: Select all

ALTER TABLE "MyTable" ADD COLUMN "ProductDesc" VARCHAR(50);
ALTER TABLE "MyTable" ADD COLUMN "Price" DECIMAL(10,2) NOT NULL;

Re: Adding a column to an existing database

Posted: Sat Feb 09, 2019 8:12 pm
by RoryOF