In my target DRS I see two options - Insert or Update and Update or Insert. Whts the difference between these two? I thought they do the same thing till I see it in my database the rows are getting duplicate if I use Insert or Update.
The other option is very slow . Please suggest.
Difference Between Insert and Update / Update and Insert
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 503
- Joined: Wed Jun 29, 2005 8:14 am
Difference Between Insert and Update / Update and Insert
Thanks
Deepak Patil
Convince Them Confuse Them .. What's the difference?
Deepak Patil
Convince Them Confuse Them .. What's the difference?
The difference should be pretty apparent from thier names - it is the order the actions are taken. In either case, the first action must fail for the second to fire, so you typically choose which to use based on which of the operations you'll have the majority of.
Unique keys can be critical to how well it works. For example, the only reason for an insert to fail should be that there is already a record with that unique key in the table so the insert fails and the update is performed. When update comes first, that 'fails' when it can't find the record to update and when that happens it tries to insert it. Like any update, that check can be slow without indexes to support it as each turns into a full table scan.
Me, I never use them, preferring instead to explicitly classify inserts versus updates and dedicate links to each.
Unique keys can be critical to how well it works. For example, the only reason for an insert to fail should be that there is already a record with that unique key in the table so the insert fails and the update is performed. When update comes first, that 'fails' when it can't find the record to update and when that happens it tries to insert it. Like any update, that check can be slow without indexes to support it as each turns into a full table scan.
Me, I never use them, preferring instead to explicitly classify inserts versus updates and dedicate links to each.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 503
- Joined: Wed Jun 29, 2005 8:14 am