我有一个表并希望从文件中插入一些数据,但我收到一些非常奇怪的错误消息,我无法理解
Input::has('group') && ...
来自文件的示例数据:
CREATE TABLE "MCS_HHGRID_MASTER" (
"FAMSRNO" VARCHAR(7),
"PNUM" INT ,
"PSEX" SMALLINT ,
"PDOBD" SMALLINT ,
"PDOBM" SMALLINT ,
"PDOBY" INT ,
"PDIED" SMALLINT ,
"PDODD" SMALLINT ,
"PDODM" SMALLINT ,
"PDODY" INT ,
"PCOBS" VARCHAR(4) ,
"PCOBN" INT ,
"PETHNICC" SMALLINT ,
"PETHNIC" SMALLINT ,
"PETHNIC06" SMALLINT ,
"PETHNIC08" SMALLINT ,
"PETHNIC11" SMALLINT ,
"PRELCM" SMALLINT ,
"PNAME" VARCHAR(30) ,
"PRES1" SMALLINT ,
"PRES2" SMALLINT ,
"PRES3" SMALLINT ,
"PRES4" SMALLINT ,
"PRES5" SMALLINT
);
错误讯息:
M10107X|1|2|1|1|1968|||||XE|||||||7|tom|1|1|1|1|
M10107X|2|2|1|5|1997||||||||||||11|dick|1|1|1|1|
M10107X|3|2|1|1|1995||||||||||||11|harry|1|1|1|1|
M10107X|4|1|1|3|1967||||||||||||7|mary|1|1|1|1|
M10107X|100|1|1|9|2000||||||||||||96|joanne|1|1|1|1|
mclient -u monetdb -d mcs "COPY INTO MCS_HHGRID_MASTER from STDIN" - < pathtofile/MCS_HHGRID_MASTER.csv
答案 0 :(得分:0)
这适用于我的示例数据:
mclient -u monetdb -d mcs -s "COPY INTO \"MCS_HHGRID_MASTER\" from STDIN NULL AS ''" - < pathtofile/MCS_HHGRID_MASTER.csv
请注意-s
标志,表名引用和NULL AS ''
语句。