Identify duplicate records and update max record

I have a table -> cust_login (schema below) that should contain only unique login and password combinations, well we found this weekend that there are duplicate rows.  What I need is a query that will identity the duplicate rows and append a value (such as 1 or a) to the front or rear of the password (or just substitute 6 or 8 random characters as the password).  

loginid        int  (identity column)
custid         int
login          varchar(25)
psword      varchar(25)

Example of data might be -

loginid           custid             login          psword
 1                   1                  clint           123abc
 2                   2                  clint           123abc
 3                   3                  max           abc456

What I need the results of the query to be:

loginid           custid             login          psword
 1                   1                  clint           123abc
 2                   2                  clint           123abc1  - (This is the only changed row)
 3                   3                  max           abc456

As  always, I appreciate your for you help
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this. This should append loginid to duplicates except the row with highest loginid...

Update cust_login
Set psword = psword + loginid
From cust_login CL
Inner Join (
    Select login, psword, Max(loginid) as max_loginid from cust_login group by login, psword having count(*) > 1
) CLM On CL.login = CLM.login and CL.psword = CLM.psword and CL.loginid < CLM.max_loginid

U can append loginid to the password for all rows in cust_login (to have the unique for all) and remember, when you need query password, plus loginid from pass

then, u can use this simple query:

Update cust_login
Set psword = psword + convert(varchar(25), loginid)

Good luck.
An other way:

UPDATE       cust_login
SET       psword = psword + loginid
FROM       cust_login
WHERE        loginid in  
      SELECT  Max(loginid) as loginid
                FROM     cust_login group by login, psword
                HAVING  count(*) > 1

Good luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clintnashAuthor Commented:
Thanks for all your input.

clintnash, the accepted answer would update password for all the duplicate rows while you asked to change all and leave one as it is - at least that is what is meant by your example.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.