# Importing from Calc: Cannot set datatype for PK field that already has Values

Im using HSQLDB in Libre 6.2 on Windows 10.

I have a table in Calc that has two Fields CityID and CityName. CityID is the PK and already contains number values.

When I copy and paste the table into Base I set CityID as the PK Field and assign Integer as its Datatype. However I get an error message saying that Integer is the wrong Datatype for the CityId field.

What am I doing wrong.

Thank you

edit retag close merge delete

( 2019-05-14 11:21:47 +0200 )edit

I did not crosspost. It is a different problem. I initially had a problem on how to assign a PK. I was told I needed to right click the filed which I did. This problem relates to assigning a datatype to a field that will be used as a PK but already contains values

( 2019-05-14 11:31:44 +0200 )edit

What is the largest value of CityID? Also what is the datatype assigned before your change?

Just had educated guess - had column headings from Calc. On first screen of dialog, was Use first line as column name checked? If not, then text mixed in with numeric data.

( 2019-05-14 12:44:58 +0200 )edit

Largest value of CityId is 440. The datatype that was auto assigned was varchar. I changed that to Integer. I did not check the Use First Line as Column Name. It seems to be working now. Ill try some more tables and if theres any problem ill post back her. Thanks very much for helping.

( 2019-05-14 14:09:39 +0200 )edit