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 |
shilpash
Posting Yak Master
103 Posts |
Posted - 2013-06-13 : 10:49:48
|
I have a primary key constraint in col a and b in destination.When I was loading it into destination it violates the constraint and the package fail.bUT I really need that data to be inserted as there is a difference in some other column.Is there any other way?Thank you in advance. |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-06-13 : 12:20:46
|
quote: Originally posted by shilpash I have a primary key constraint in col a and b in destination.When I was loading it into destination it violates the constraint and the package fail.bUT I really need that data to be inserted as there is a difference in some other column.Is there any other way?Thank you in advance.
If there is a primary key constraint on columns a and b, what it is really saying is that no matter what the difference in other columns, the combination of a and b has to be unique.If you do need non-uniqueness on those columns, that sounds like the business logic is not in sync with the database constraint.Your only choice is to remove the primary key (uniqueness constraint). You can consider adding additional columns to the primary key constraint to make the combination unique.When there are no such candidate key columns, people often use surrogate keys - for example an identity column - as the primary key. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-14 : 01:42:23
|
You need to be careful on this. Check the impact first and see which all code are using this table. When you change primary key there might be lot of dependent code which may get affected as they may rely upon the uniqueness of existing column combination. So these type of changes have to be done carefully after discussing with all involved stakeholders and doing a thorough business impact analysis.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|