[GIS] Changing format of column from character to integer using MapInfo

mapinfo

I have two tables which I am trying to do distance calculations on in the SQL select window of MapInfo. I have completed these calculations before so I am happy that the formula I am using is correct, however; MapInfo shows a mismatch error which I understand is to do with the colums I am trying to match not being the same format i.e. one student ID is in string (Character) and one student ID is in value (integer). I have checked this in the table structure and this is the case. I have tried to change the format in the CSV and overwrite the table but the issue remains. I have also tried adding: int(table.stud_id) to the WHERE clause and this clears the "data mis-match" error but I then get an "invalid join in WHERE clause error".

Is there away to change the format of the column in the table from character to interger in Mapinfo?

Best Answer

First, make sure your CSV file has been saved as a native table. When opening the CSV, you can check the option "Create copy in MapInfo format for read/write" in the bottom of the Open dialog

enter image description here

If you already have the CSV file open in MapInfo, use Save Copy as to save it into a native table.

Now you can modify the column types, and the table structure in general, via the Table Structure dialog.

In MapInfo Pro 15.2/16.0, right click on the table in the Explorer window, and select "Table Structure".

If you are using an older version of MapInfo Pro, you can access the Table Structure dialog via Table, Modify, Table Structure

In the dialog Modify Table Structure ..." select the column you want to change and then select the column type below you want it to be, here Integer.

Hit OK to make the changes to the table structure. Note that the table will be closed from any windows. It is still open in MapInfo Pro though. You just need to show it in a window again.

enter image description here

Related Question