Solved

How do I use replace to remove single quotes and commas?

Posted on 2007-03-26
1
501 Views
Last Modified: 2012-06-21
I have a column called VirtualTours in which I want to remove single quotes and commas. I am trying to use the replace function. See below (incorrect) example.

BEGIN TRAN; UPDATE    listings
                              SET              [virtualtours] = replace('''', '', [virtualtours]);
                                                         SELECT     VirtualTours
                                                          FROM         listings
                                                          WHERE     LEN(VirtualTours) > 1; ROLLBACK;

For example, I have 'vt',   and I want it to return vt.
0
Comment
Question by:Promethyl
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 18796543
UPDATE    listings
  SET   [virtualtours] = replace([virtualtours], '''', '')
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PK numbers not follow 8 60
Insert statement is inserting duplicate records 15 57
Compare data between two databases 16 95
ms sql + top 1 for each customer 3 43
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now