WHILE EXISTS (SELECT * FROM table WHERE Field LIKE '%\thirdparty\thirdparty\%') BEGIN UPDATE table SET Field = REPLACE(Field, '\thirdparty\thirdparty\', '\thirdparty\') END