Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Sql: update to replace varchar column by pattern

Avatar of sfun28
sfun28 asked on
Microsoft SQL Server 2005Microsoft SQL Server 2008SQL
5 Comments1 Solution592 ViewsLast Modified:

I've got a column of varchar data that's populated with standard sql statements.  so the table might look like this:
SELECT X FROM Y where [abc]='def' and [ghi]='asdf'
INSERT INTO J (abc,def) Values (1,'aced')

I want to update the Statement column so that all values within single quotes are replaced with empty string.  so in the example above the result would be:

SELECT X FROM Y where [abc]='' and [ghi]=''
INSERT INTO J (abc,def) Values (1,'')

I don't know a prior how many single quotes there are, but I do know that they will always be balanced.

Avatar of Lowfatspread
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers