简体   繁体   中英

Importing data from MS Excel to SQL Server 2008 R2

I've a Microsoft Excel file with 25 columns and I used the data import wizard on SQL Server 2008 R2 studio to import it to already existing table. But, it only maps 14 columns and ignores the rest. Does it have a column number limit or there is a problem with my data?

Can you give some example of your data?

In the mean time... When you're performing your import, I assume you are reaching the Select Source Tables and Views Page;

在此处输入图片说明

At this stage, you can edit your column mappings by pressing the Edit Mappings button. This will show the following screen;

在此处输入图片说明

Make sure that all your columns are selected there.

Also, on the following screen, it will warn of any mismatches in data;

在此处输入图片说明

Are you seeing any warnings here?

I'm not familiar much with SQL Server, but according to this: Excel file Import to Sql server 2008 - column limit for Excel is 255 which is far beyond your numbers. Most likely problem is in your data, but without having the example it's impossible to say what's wrong.

You can do the other way around.

Step 1. Import sheet in a new table.

Step 2. Use Bulk Query to insert into your prefered table

I think this will solve your Problem .

Try to create the Excel columns and table structure in the same format and structure as ms sql table is. Open the excel select the row (whole row by clicking on row number) select the whole data till end of the data (selected first row to last row). press ctrl+c

edit the ms sql table, go to last row where you can find blank.

Select that row by clicking on row button and press ctrl+v.

Done you're excel data will be inserted into sql table.

I tried it in MS SQL 2008

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM