When doing an update on a set of records, how do i get previous updates to show on current row to update in UDF SO i have a rowset of 10 UIDs. They are all dupes, lets say DUPEUID. I have a UDF that will take the UID, check it against the table to see if there is a dupe, and update the UID to DUPEUID01.

The problem i'm having is that my update statement updates a rowset. The first row gets updated, but when the 2nd row is evaluated  the previous updated row is not found during the SELECT. I suspect i am running into an isolation issue. 

I have tried REPEATABE, SERIALIZABLE, to no avail. 

is there no way to do this in a rowset operation? DO i have to create a cursor and loop through all the dupes?

Here's a rough example:

there are 3 rows

UID  
-------  
UIDDUPE  
UIDDUPE  
UIDDUPE


all 3 rows same value.

UDF that goes and does this:
select * from uid table looking for dupes.

and an update that calls the UDF

update table
set UID = dbo.UIDFIX(UID)


when the update runs , it updates the first row to UIDDUPE01, when it gets to the 2nd row, it does a select,and does NOT find the previously updated row. so it creates ANOTHER UIDDUPE01. 

The logic for updating these UIDS are much MORE complicated than the simple way i've shown it here. The accepted answer will stick to my question, and not say well you shouldnt' use..... This is the real world. sometimes we have horrible situations. 

The question has to do with UDF's and set based consistency?
(You edited your question, so now I'm editing my answer)

Stop using a UDF for it. Do it all in one hit like this:

WITH Numbered AS 
( SELECT *,
  ROW_NUMBER() OVER (PARTITION BY UID ORDER BY UID) AS DupeNum
  FROM theTable
)
UPDATE Numbered SET UID = UID + '_' + CAST(DupeNum AS VARCHAR(10))
WHERE DupeNum &gt; 1;


By doing it all at once, you will avoid the issues you have, because it works out what they should all become and applies them in a single transaction.

Also - put an underscore or something in. If you have UIDs like D, D, D2, then it's better to end up with D, D_2, D1 than D, D2, D2. Use a character that isn't used in regular UIDs. And ideally, store what it was originally somewhere, because if you get more Ds coming through, you want to be able to tell that you really have a third duplicate, not just a second one.

A further edit to clarify:

A scalar UDF is a procedure. It has BEGIN and END, and runs row by row. When this runs repeatedly in a larger query, it runs within the context of the transaction, and therefore sees the impact of earlier work within the transaction.

If you MUST use the UDF, create a temporary table containing the rows that you want to update to, and then perform an update by joining this temporary table. While you populate the temporary table you're not making any changes to the table, so every UDF call will be unaffected by those changes. Then you can do it without having a UDF in your actual update statement.

Yet another edit;

What does this do?

WITH Numbered AS 
( SELECT *,
  ROW_NUMBER() OVER (PARTITION BY UID ORDER BY UID) AS DupeNum
  FROM theTable
)
UPDATE Numbered SET UID = dbo.UIDFIX(UID)
WHERE DupeNum &gt; 1;


And more...

How about:

--First get the new values
WITH Numbered AS 
( SELECT *,
  ROW_NUMBER() OVER (PARTITION BY UID ORDER BY UID) AS DupeNum
  FROM theTable
)
SELECT *, dbo.UIDFIX(UID) AS NEWUID
INTO #NewVersion
FROM Numbered
WHERE DupeNum &gt; 1;

--Now update them all
UPDATE theTable
SET UID = n.NEWUID
FROM #NewVersion AS n
WHERE n.PK = theTable.PK;