I am trying to add leading zero's to a column with this update query:
set p.personnum = Right('0000000000' + [badgenum],10)
from person P
join Badgeassign b
on p.personid = b.personid
But I get this error:
Server: Msg 2601, Level 14, State 3, Line 2
Cannot insert duplicate key row in object 'PERSON' with unique index 'XU1_PERSON'.
The statement has been terminated.
What am I doing wrong ?