Good afternoon,
I have an issue where a client updated a table combining two companies of data. Now they have about 400 records that are duplicated. Meaning, for those 400 records, there are 2 records sharing the same number for 200 pairs of employees now. I need to find an easy way to update this as I am worried it propagated over multiple tables and will need to be corrected also.
This is what I am using to 'find the duplicte'
SELECT
[p_empno],COUNT(*)
FROM [dbo].[hrpersnl]
Group by p_empno
having count(*) > 1
GO
Now that I have found them, is there a way that I can add a "1" to the second record of each of the duplicates so they will not all be duplicated through a SQL script? I have tried a few UPDATE scripts to no avail. Thank you in advance for your help!
I have an issue where a client updated a table combining two companies of data. Now they have about 400 records that are duplicated. Meaning, for those 400 records, there are 2 records sharing the same number for 200 pairs of employees now. I need to find an easy way to update this as I am worried it propagated over multiple tables and will need to be corrected also.
This is what I am using to 'find the duplicte'
SELECT
[p_empno],COUNT(*)
FROM [dbo].[hrpersnl]
Group by p_empno
having count(*) > 1
GO
Now that I have found them, is there a way that I can add a "1" to the second record of each of the duplicates so they will not all be duplicated through a SQL script? I have tried a few UPDATE scripts to no avail. Thank you in advance for your help!