;WITH cteEmp AS
(
SELECT
ROW_NUMBER() OVER(PARTITION BY Name ORDER BY Name ) AS rno,
Name
FROM Emp where EmpId IS NOT NULL
)
UPDATE cteEmp SET Name =Name +CAST(rno AS VARCHAR)
WHERE rno>1
(
SELECT
ROW_NUMBER() OVER(PARTITION BY Name ORDER BY Name ) AS rno,
Name
FROM Emp where EmpId IS NOT NULL
)
UPDATE cteEmp SET Name =Name +CAST(rno AS VARCHAR)
WHERE rno>1
No comments:
Post a Comment