I want write a simple query which will fetch data from a table (which may contain quotes and double quotes) but it should remove all the quotes in it.
e.g. for the following data:
EmpID EmpName CompName
----- ------- -----------
1234 "xyz" A's Company
Output Should Be:
EmpID EmpName CompName
----- ------- -----------
1234 xyz As Company
Make use of replace function of sql server resolve the issue for you
REPLACE ( string_expression , string_pattern , string_replacement )
Note:
ordinarily you’d replace ‘ with ” and this will make SQL happy when querying the database. The trick with any of the built-in SQL functions (like replace) is that they too require you to double up your single quotes.
So to replace ‘ with ” in code you’d do this