Search code examples
sqlms-access

Microsoft Access can't append all the records in the append query due to a type conversion failure


Why am I getting a type conversion error?

Here is the insert query:

INSERT INTO Products(BarcodeID, ProductColor, ProductSize, ProductName)
VALUES (23749827548, 'Turquoise', 'XS', 'Sun T-shirt')

Here is the query where I created the Products table:

CREATE TABLE Products
(
BarcodeID int NOT NULL PRIMARY KEY,
ProductColor varchar(20),
ProductSize varchar(20),
ProductName varchar(20)
);

I tried inserting the BarcodeID with and without single quotation marks to no avail.

Any idea what the problem is?


Solution

  • Posted from my comments above with code for table:

    You are using INT as your ID but your value exceeds INT size, try changing to BIGINT

    Link to SQL INT datatypes: https://learn.microsoft.com/en-us/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql?view=sql-server-ver15

    CREATE TABLE Products
    (
    BarcodeID BIGINT NOT NULL PRIMARY KEY,
    ProductColor varchar(20),
    ProductSize varchar(20),
    ProductName varchar(20)
    );