无法查询外部表 - 批量加载数据转换错误

Can't query external table - Bulk load data conversion error

提问人:organza 提问时间:11/17/2023 更新时间:11/17/2023 访问量:16

问:

嗨,我刚刚创建了我的外部表,它添加得很好,只是我似乎无法查询它。我一直收到此错误:

大容量加载数据转换错误(类型不匹配或字符无效) 对于指定的代码页),第 1 行的第 1 列 (Student_ID) dbo。ETStudents。

用于构建外部表的代码为:

CREATE EXTERNAL TABLE ETStudents
     (
     Student_ID INT,
     First_Name VARCHAR(25),
     Last_Name VARCHAR(25),
     Age INT,
     Over_18 TINYINT,
     Email VARCHAR(25),
     City VARCHAR(25),
     Country VARCHAR(25)
)WITH
 (
     DATA_SOURCE =course_data,
     LOCATION = '/MySQL_Project-Table_Students.csv',
     FILE_FORMAT = CsvFormat
 ); 

我是这样查询的:

SELECT TOP (100) 
[Student_ID]
,[First_Name]
,[Last_Name]
,[Age]
,[Over_18]
,[Email]
,[City]
,[Country]
 FROM [dbo].[ETStudents]

原始数据集为:

"Student_ID","First_Name","Last_Name","Age","Over_18","Email","City","Country"
1,"Sarah","Brooks",17,0,"[email protected]","Cardiff","Wales"
2,"Jordan","Parker",19,1,"[email protected]","London","England"
3,"Erik","Reed",32,1,"[email protected]","Dublin","Ireland"
4,"Zoya","Maya",18,0,"[email protected]","Frankfurt","Germany"
5,"Chris","Tucker",40,1,"[email protected]","New York","United States"
6,"Mia","Sana",25,1,"[email protected]","Leeds","England"
7,"Nadine","Kareem",16,0,"[email protected]","Cambridge","England"
8,"Tatenda","Chintembo",23,1,"[email protected]","Paris","France"
9,"Mutinta","Chanda",20,1,"[email protected]","Johannesburg","South Africa"
SQL 外部 apache-synapse

评论

1赞 Brad 11/17/2023
看起来您的导入不需要标题。检查标题的批量导入设置,或者尝试不使用标题。
1赞 organza 11/17/2023
是的,我确实怀疑过。删除了它并修复了 Email 的 VARCHAR 值,它运行良好。谢谢!

答: 暂无答案