Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 20-Apr-16 0:19am
Comments
CHill60 20-Apr-16 6:09am    
What is the error?
dhanasekaranm 20-Apr-16 7:15am    
ok. Now it working as per my requirement. Thanks

1 solution

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:
SQL
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900