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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Move Customer Notes

Author  Topic 

fawadafr
Starting Member

47 Posts

Posted - 2010-05-13 : 17:43:34
There are some duplicate customer records in our database. I am able to identify them by their name, address, and contact information. I can certainly write SQL query to move all notes from one customer code to another without changing the notes details such as who created it and date. Unfortunately, I must do lots of copy-and-paste to get this done.

Can this project be done with simply executing a block of SQL query without causing sever damage to the clean records?

Thank you,

--
Fawad Rashidi
Web Developer
www.fawadafr.com

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-14 : 03:04:31
Can you post some sample data with expected result?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

umstorom
Starting Member

6 Posts

Posted - 2010-05-14 : 04:01:00
Hey Fawad,

Post you db structure map and the expected result, and I'll build the right query for you.

http://www.developerbay.net
Go to Top of Page

fawadafr
Starting Member

47 Posts

Posted - 2010-05-14 : 16:33:06
Hello Umstorom and Madhivanan,

Here is the structure of the table:



I was thinking of joining the CRMNote table to customer table on EntityCode to get the username of the people who created the duplicate records.

All records that are created by username='fawad' will stay but all the duplicate records that were created by the other usernames will be obsolete. Before we obsolete the records, we need to move their notes to the active records.

Please let me know if you have any question!

Thank you very much for your help!

--
Fawad Rashidi
Web Developer
www.fawadafr.com
Go to Top of Page
   

- Advertisement -