不正确的整数值:“'ProductSubcategoryKey'列的''

时间:2018-09-29 15:39:19

标签: mysql database

我正在尝试将CS​​V文件导入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",

这是我的桌子的结构:

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
)

他们都具有此字段,,。但是,它不是字符串,并且允许使用NULL值,所以我不明白问题出在哪里

非常感谢

1 个答案:

答案 0 :(得分:0)

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