Reputation: 29
REPLACE(ab.FirstName,', '')
How can i remove only this character ' from a string in sql
Upvotes: 0
Views: 381
Reputation: 640
Please check my solution .
DECLARE @stringdata nvarchar(500)='ronak'''
select @stringdata
select REPLACE(@stringdata,'''', '')
Original string is "ronak'patel" .
String after removing single quotation is "ronakpatel".
Thanks .
Upvotes: 0
Reputation: 5036
If you are fetching records from existing table:
select REPLACE(ab.FirstName,'''', '')
If you are comparing values:
select REPLACE(name,'''', '')
from Table1
where name ='AB O''Donnell'
Upvotes: 0
Reputation: 1587
Try this one
SELECT REPLACE(ab.FirstName,'''', '') as FirstName
For more details like
Upvotes: 0
Reputation:
You need to double up your single quotes like below
REPLACE(ab.FirstName, '''', '')
or
DECLARE @name nvarchar(50) = 'ab''c'
SELECT REPLACE(@name,'''', '')
Upvotes: 2