Usher
Usher

Reputation: 2146

Remove special char using select statement SQL

Right now I am using the following query to update (remove) the existing sql char

UPDATE tblCompany
SET CompanyName = replace(CompanyName , '''', '')

is there anyway when I try to strip those spl char when I use select statment ?

like

Select ID,CompanyName(replace(CompanyName , '''', '')) from tblcompany

Upvotes: 1

Views: 125

Answers (2)

Jigs Virani
Jigs Virani

Reputation: 4167

You have replace with like this.

 SELECT ID, REPLACE(CompanyName ,'''', "") as company_name FROM tblCompany

For detailed example click here

Upvotes: 2

Arun Palanisamy
Arun Palanisamy

Reputation: 5459

You can use the below query:

select ID,replace(CompanyName , '''', '') as CompanyName from tblCompany;

But Remember this is just temporary ,holds only till current selection. It will not be updated in the main table.

Upvotes: 3

Related Questions