列“productsubcategorykey”的整数值“”不正确

6yoyoihd  于 2021-06-19  发布在  Mysql
关注(0)|答案(1)|浏览(292)

我正在尝试将我的csv文件导入mysql数据库。然而,我被提到的错误。它适用于我800张唱片中的70%。这是错误记录的一个例子。

1,"AR-5381",,"Adjustable Race","NA",
2,"BA-8327",,"Bearing Ball","NA",
3,"BE-2349",,"BB Ball Bearing","NA",
4,"BE-2908",,"Headset Ball Bearings","NA",
5,"BL-2036",,"Blade","NA",
6,"CA-5965",,"LL Crankarm","Black",
7,"CA-6738",,"ML Crankarm","Black",
8,"CA-7457",,"HL Crankarm","Black",
9,"CB-2903",,"Chainring Bolts","Silver",
10,"CN-6137",,"Chainring Nut","Silver",

这是我table的结构:

CREATE TABLE [Product](
    [ProductKey] [int] NOT NULL,
    [ProductAlternateKey] [nvarchar](25) NULL,
    [ProductSubcategoryKey] [int] NULL,
    [ProductName] [nvarchar](50) NOT NULL,
    [Color] [nvarchar](15) NOT NULL,
    [Size] [nvarchar](50) NULL
)

他们都有这个领域。但是,它不是一个字符串,允许空值,所以我不知道问题出在哪里
非常感谢

fcipmucu

fcipmucu1#

如何将数据导入数据库?这里的问题是,它将第三列读取为空字符串,这当然对整数列无效。因此,在您的情况下,您应该告诉用于导入的任何程序根本不导入此列或将其更改为 null .

相关问题