How do you strip a character out of a column in SQL Server?

前端 未结 4 708
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 06:49

How do you remove a value out of a string in SQL Server?

4条回答
  •  生来不讨喜
    2020-12-05 07:08

    Use the "REPLACE" string function on the column in question:

    UPDATE (yourTable)
    SET YourColumn = REPLACE(YourColumn, '*', '')
    WHERE (your conditions)
    

    Replace the "*" with the character you want to strip out and specify your WHERE clause to match the rows you want to apply the update to.

    Of course, the REPLACE function can also be used - as other answerer have shown - in a SELECT statement - from your question, I assumed you were trying to update a table.

    Marc

提交回复
热议问题