This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Changing Column Types.

Tags: None
(comma "," separated)
Ianwhit
Registered Member
Posts
32
Karma
0
OS

Changing Column Types.

Wed Apr 11, 2012 4:15 pm
Hi All

When I moved my Database from Base to Kexi I prepared the exact same table as I had before and imported my data into it from a .csv file.

A few of the fields were interpreted as 'Number' fields by Kexi when they should be 'Text' fields. (ie Zip Nos, and Birthdays and years)

If I try to change these it deletes all my data and when I re-import I'm back at the beginning again with the wrong types.

How do you change a column type without loss of data?

Thanks a lot.

Ian W.
User avatar
jstaniek
Moderator
Posts
1027
Karma
2
OS

Re: Changing Column Types.  Topic is solved

Thu Apr 12, 2012 7:48 pm
Ianwhit wrote:When I moved my Database from Base to Kexi I prepared the exact same table as I had before and imported my data into it from a .csv file.

A few of the fields were interpreted as 'Number' fields by Kexi when they should be 'Text' fields. (ie Zip Nos, and Birthdays and years)


Hi Ian,
You can select exact data type for each field before importing. This always helps a bit. CSV is typeless, but Kexi is really good at guessing the type - if there are only numbers in a CSV column, Kexi picks number type (floating-point or integer). If you disagree, just change e.g. to text type.

Ianwhit wrote:If I try to change these it deletes all my data and when I re-import I'm back at the beginning again with the wrong types.

How do you change a column type without loss of data?


For beginners (not using command line) I recommend exporting to CSV, and importing back. Or even exporting to CSV, opening in a spreadsheet, editing columns, exporting to CSV and importing CSV into Kexi.

We had shell scripts for adding columns but I no longer would advertise them.
2.5 would finally have some useful features for your needs. This is in 4 months (!).

See also "How to Add Column to Existing Table"


Best regards,
Jarosław Staniek
• Qt Certified Specialist
KEXI - Open Source Visual DB Apps Builder
• Request a feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]