entire table replace ""

  • The below query is replacing " from column Col001 from StageTable

    I want to do it for entire table or u can say From column Col001 to column Col070

    Is there any method to repeat this on all columns ?

    while @@rowcount > 0

    update StageTable

    set Col001 = replace(Col001, substring(Col001, patindex('%["]%', Col001), 1), '')

    where patindex('%["]%', Col001) <> 0

  • Do you mean REPLACE all single quote with nothing (i.e. REMOVE all single quote)?

    Quick and dumb way is to copy the line 70 times

    Maybe generate UPDATE script via SSMS to save typing some column names

    More work is probably look for sys columns and auto generate UPDATE script dynamically

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply