Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tash4206
Starting Member
7 Posts |
Posted - 2004-12-09 : 00:26:54
|
| I am attempting to load data from a EXCEL Sheet having 3 columns. The table I am loading into also has 3 colums. But the issue is 2 of the columns in the tables are composite keys...and one of the will column contain recrds that are duplicate. Is it even possible to load dupes records into a composite key field? Appreciate any suggestion.Thanks!-Tash |
|
|
jsiedliski
Yak Posting Veteran
61 Posts |
Posted - 2004-12-09 : 14:31:42
|
| The question I would ask is do you want to keep the duplicate records or not?If so, then you obviously need to remove the primary key constraint on this table (or change your key)If not, I recommend that you create a "staging" table, which is a copy of the main table except you do not have the primary key constraint. You would first load the data into this staging table, then do any necessary manipulation (such as deleting duplicates, removing leading / trailing spaces, etc.). Finally, you would append from the staging table to the main table.Hope this methodology helps,Jack:) |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-12-09 : 15:46:19
|
quote: Is it even possible to load dupes records into a composite key field?
no. that's the whole POINT of a primary key -- it cannot contain duplicates.- Jeff |
 |
|
|
jsiedliski
Yak Posting Veteran
61 Posts |
Posted - 2004-12-09 : 16:30:32
|
| I think you misunderstand me Jeff. All we know is there are 3 columns, two of them make up a composite key on the SQL side, but the data has duplicates (based on this Primary Key definition)SO, either the way the key is defined is incorrect OR the data has duplicates which need to be removed. The solution is specific to the reality of the data.--Jack:) |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-12-09 : 17:14:17
|
| I was quoting and referring to the original question, not your response ... i hear what you are saying.- Jeff |
 |
|
|
|
|
|
|
|