I have a column called NOMBRE
. In this there are three patients called "Juan". What I want is to distinguish them by adding a number followed after their name. Something like this:
Juan1
Or if there were 30252 records called Juan, put:
Juan30252
I did this but it does not go in registry order:
SELECT Paciente, COUNT(Paciente) AS Dupenumber
INTO #Cambiado
FROM PS_GameData.dbo.Chars
GROUP BY Paciente
HAVING ( COUNT(Paciente) > 1 )
UPDATE PS_GameData.dbo.Chars
SET Paciente = Paciente + CAST((BINARY_CHECKSUM(NEWID()))AS VARCHAR)
WHERE Paciente in (SELECT Paciente FROM #Cambiado)
DROP Table #Cambiado