Search code examples
sql-server-2008selectreplacesubquery

Subquery returned more than 1 value. Replace single character on select


How do I replace a character with multiple rows using update

UPDATE tbl_FMaster
SET PHOTO = (
        SELECT Replace(PHOTO, 'D:\', ' A : \ ') PHOTO
        FROM tbl_FMaster
        )


Solution

  • You don't need to use a subquery at all assuming you just want to run the REPLACE statement on the photo value in each row.

    UPDATE tbl_FMaster
       SET photo = REPLACE( photo, 'D:\', 'A:\' );