[英]csv import from excel into phpmyadmin missing data
I am currently trying to upload data from an excel spreadsheet into a sql server run through a university phpmyadmin. 我目前正在尝试将数据从Excel电子表格上传到通过大学phpmyadmin运行的sql服务器中。 I have been able to upload other files successfully.
我已经能够成功上传其他文件。 However, when I upload one particular file with 3 columns and 20 rows, it instead uploads the 3 columns and only data for the 3 rows.
但是,当我上传一个具有3列20行的特定文件时,它会上传3列并且仅上传3行的数据。 I have been advised to tick the box that says "replace existing data" and have selected left "columns enclosed with" blank.
建议我在显示“替换现有数据”的方框中打勾,并在左侧选中“用空格括起来的列”。 This is the data I was hoping to upload:
这是我希望上传的数据:
FlyCrew01 Yes 1
FlyCrew02 Yes 2
FlyCrew03 No 3
FlyCrew04 Yes 4
FlyCrew05 No 5
FlyCrew06 Yes 6
FlyCrew07 Yes 7
FlyCrew08 Yes 8
FlyCrew09 Yes 9
FlyCrew10 Yes 10
FlyCrew11 Yes 11
FlyCrew12 Yes 12
FlyCrew13 Yes 13
FlyCrew14 Yes 14
FlyCrew15 Yes 15
FlyCrew16 Yes 16
FlyCrew17 Yes 17
FlyCrew18 Yes 18
FlyCrew19 Yes 19
FlyCrew20 Yes 20
The end result after uploading is this however: 上传后的最终结果是:
Full texts
Crew_ID Ascending
Available
Licence_Number
Edit Edit
Copy Copy
Delete Delete
FlyCrew0
Yes
9
Edit Edit
Copy Copy
Delete Delete
FlyCrew1
Yes
19
Edit Edit
Copy Copy
Delete Delete
FlyCrew2
Yes
20
As you can see, it is missing the data for the other 17 rows. 如您所见,它缺少其他17行的数据。 This is the create table command I was using before I uploaded the data:
这是我在上传数据之前使用的create table命令:
CREATE TABLE Unavailability
(Crew_ID varchar (8) NOT NULL,
Available text (3),
Licence_Number int (8),
CONSTRAINT pk11 primary key (Crew_ID));
Can someone please tell me what I can do to fix this as I want to prevent it happening to other tables as well. 有人可以告诉我如何解决此问题,因为我也想防止其他表发生此问题。 Thanks.
谢谢。
Your crew_id field has a data length of 8 characters, yet every single value you provided in your example is 9 characters long. 您的crew_id字段的数据长度为8个字符,但是您在示例中提供的每个值都为9个字符长。 Try changing the length to 9, ie:
尝试将长度更改为9,即:
CREATE TABLE Unavailability
(Crew_ID varchar (9) NOT NULL,
Available text (3),
Licence_Number int (8),
CONSTRAINT pk11 primary key (Crew_ID));
The inserts should otherwise be valid as you can see here - http://sqlfiddle.com/#!8/74544/1/0 如您在此处看到的那样,插入内容应该是有效的-http: //sqlfiddle.com/#!8/74544/1/0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.