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?