Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace quote mark character in table using SQL

I am trying to do a simple find and replace query using MSSQL, however the query runs without removing the character.Keep in mine I want a query without having to list the unique data in each row.

Current row

    Number 
    ''12454545''
    ''12454''
    ''1895622''
    ''9846252''

Required Output

    Number 
    12454545
    12454
    1895622
    9846252

Therefore I only need to remove the ('') from the value in each row. The find and replace function in Excel is exactly the principle required here.

Here are two of the queries I have tried that runs successfully, however it does not remove the ('') .

UPDATE [Table]
SET [Number] = REPLACE([Number], '''', '')

SELECT REPLACE([Number], '''', '') FROM [Table]

Any suggestions?

like image 492
Chantelle Brink Avatar asked Sep 23 '26 01:09

Chantelle Brink


1 Answers

Okay, I think you can use SET QUOTED_IDENTIFIER OFF before your query something like this -

SET QUOTED_IDENTIFIER OFF;

UPDATE [Table]
SET [Number] = REPLACE([Number], "'", "")

SET QUOTED_IDENTIFIER ON;
like image 161
Krishnraj Rana Avatar answered Sep 25 '26 07:09

Krishnraj Rana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!