Reputation: 11
The input file name is employee and it contain the data like:
eno,ename,esal
1,sravan,2000
2,kumar,12000
3,naresh,10000
3,sathish,1500
I need to load this data into a sql server table that is emp table, but the eno field is a primary key. When I tried to insert the data, I was given an error. So how can I resolve this problem?
Upvotes: 1
Views: 104
Reputation: 1174
Assuming I understand what you are asking, you are receiving an error because you are trying to insert the same ENO (3rd record and 4th record both containing an ENO of 3) into the primary key. Your primary key uniquely identifies each record in the table. Primary keys cannot contain nulls and must be unique.
You can either modify the SQL table by adding an auto-incrementing field and allow that new field to become your primary key, or clean your data only allowing unique ENOs to be passed through to your SQL server table.
Upvotes: 1