Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL search and replace text char 1

Status
Not open for further replies.

Minimorgie

Technical User
Feb 14, 2005
29
GB
Hi,
I'm trying to write a sql script for sql server that searches a table column for a char and replaces it with either null or space. I can only find how to do this if the char is in a known position and unfortunately it will not always be. Any advice (explained as simply as possible!), would be welcomed.

Thanks
Minimorgie
 
Have a look at the REPLACE function

i.e. to replace the character 'C' with '' in the column ColumnA in a table MYTable you would use code

Code:
UPDATE MyTable
SET ColumnA = REPLACE(ColumnA, 'C', '')


"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top