Reg:在SQL server中导入excel [英] Reg : import excel in SQL server

查看:82
本文介绍了Reg:在SQL server中导入excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个包含4列的sql表。



id,CompanyName,细分,CustomerSegment。



这里id列是自动标识列。



现在我有一个excel与不包括ID列的3列数据。我需要使用sql服务器中的import functonality将excel行传输到表。



我已经尝试使用已选中启用身份插入复选框。



但仍然出错。如果有更好的解决方案,请告诉我。



谢谢



我尝试了什么:







我有一个包含4列的sql表。 />


id,CompanyName,Segment,CustomerSegment。



这里id列是自动标识列。



现在我有一个包含3列数据的Excel,不包括ID列。我需要使用sql服务器中的import functonality将excel行传输到表。



我已经尝试使用已选中启用身份插入复选框。



但仍然出错。如果有更好的解决方案,请告诉我。



谢谢

Hi,

I have a sql table with 4 columns.

id,CompanyName,Segment,CustomerSegment.

Here id column is auto identity column.

now i have a excel with 3 columns data excluding ID column. i need to transfer the excel rows to table using import functonality in sql sever.

Already i have tried using checked the enable identity insert checkbox.

But still getting an error. Please let me know if there any better solution.

Thanks

What I have tried:

Hi,

I have a sql table with 4 columns.

id,CompanyName,Segment,CustomerSegment.

Here id column is auto identity column.

now i have a excel with 3 columns data excluding ID column. i need to transfer the excel rows to table using import functonality in sql sever.

Already i have tried using checked the enable identity insert checkbox.

But still getting an error. Please let me know if there any better solution.

Thanks

推荐答案

好的我已经能够重现你的问题,并成功导入数据。



我创建了一个这样的表,我希望它类似于你的表:

Ok I've been able to reproduce your problem and also import data successfully.

I created a table like this, which I hope is similar to your table:
create table Book1
(
	id int identity(1,1),
	CompanyName varchar(20),
	Segment varchar(20),
	CustomerSegment varchar(20)

)



在我的电子表格中,我有


In my spreadsheet I had

CompanyName Segment CustomerSegment
Co1	    seg1	cs1
Co2	    seg2	cs2

我希望它类似于你的电子表格结构。



然后我按照导入向导的步骤但是确保选中启用身份插入复选框



我的电子表格中的行都是成功插入表格

which I hope is similar to your spreadsheet structure.

I then followed the Import wizard steps but ensured that the "Enable Identity Insert" checkbox was not ticked.

The rows from my spreadsheet were all inserted into the table successfully


这篇关于Reg:在SQL server中导入excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆