March 12, 2012 at 10:23 am
HI friends,
i am using merge statement to insert and update some records between two tables ..
both of the table are same structure..i am just synchronizing the tables..
when i try to do that, it gives violation of duplicate error...there are five columns which is represented as unique index...
primary key is not involved in the index..both of the table is having same primary key ID, but index is different...so there is no new record is going to insert, but some how it gives error with index columns. I want to see which record is giving error..
help me by Giving some SQL statements to show that error giving records
Thanks,
Charmer
March 12, 2012 at 10:36 am
366 points! You are not first-timer here.
Please try to post your question as per "forum etiquette", link at the bottom of my signature.
March 13, 2012 at 2:55 am
Eugene Elutin (3/12/2012)
366 points! You are not first-timer here.Please try to post your question as per "forum etiquette", link at the bottom of my signature.
sorry about that..i was in a hurry..o.k let me try to get some sample data posted over here...
Thanks,
Charmer
March 13, 2012 at 6:29 am
Charmer (3/13/2012)
Eugene Elutin (3/12/2012)
366 points! You are not first-timer here.Please try to post your question as per "forum etiquette", link at the bottom of my signature.
sorry about that..i was in a hurry..o.k let me try to get some sample data posted over here...
Too much in a hurry to type sql server find duplicates in Google?
Typing this question in a forum takes even more time...
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 13, 2012 at 7:17 am
Use Rownumber() it will create a virtual column of separate id for each row.. then by using that id you can update any duplicate record.
and its bad practice if your table is not having primary key. 😛
Thanks & Regards,
Pallavi
March 15, 2012 at 12:09 am
when i try to do that, it gives violation of duplicate error...there are five columns which is represented as unique index..., but index is different...
If your syncing the two table the unique index on these tables need to be the same.
Check the definition of the indexes and then compare the column to identify which column is missing in the index definition of the source table.
e.g if indx1 consists of columns A, B , C, D and E
and indx2 consists of A,B,D,E,F
then u know that a combination of values ABCD is not creating the required uniqueness.
March 15, 2012 at 4:00 am
Friends,
Some one temme how to add files over here...?
Thanks,
Charmer
March 15, 2012 at 4:54 am
Charmer (3/15/2012)
Friends,Some one temme how to add files over here...?
Add files where? Your email attachment?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 15, 2012 at 5:09 am
Koen Verbeeck (3/15/2012)
Charmer (3/15/2012)
Friends,Some one temme how to add files over here...?
Add files where? Your email attachment?
Yes Koen
Thanks,
Charmer
March 15, 2012 at 5:41 am
You mean the attachments here at SQLServerCentral?
When you create a new post, you have a button Edit Attachments in the Post Options a bit down.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 15, 2012 at 5:44 am
You can just place your code surrounded with special tags which you can see on the left side of the text box where you're typing your post...
March 15, 2012 at 5:48 am
Koen Verbeeck (3/15/2012)
You mean the attachments here at SQLServerCentral?When you create a new post, you have a button Edit Attachments in the Post Options a bit down.
yes i got it....i have never rolled down the screen before...that was my problem...sorry about that....Thanks to Koen and Eugene
Thanks,
Charmer
March 15, 2012 at 5:51 am
pallavi.unde (3/13/2012)
Use Rownumber() it will create a virtual column of separate id for each row.. then by using that id you can update any duplicate record.and its bad practice if your table is not having primary key. 😛
Thank you..for your suggestion
Thanks,
Charmer
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply