Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Sql server REPLACE() question

Thread Tools

Sql server REPLACE() question

skb3 skb3 is offline
Junior Member
Join Date: Nov 2007
Posts: 1
Could anyone help me here I have products in a table, but I need to select a distinct list, the list contains the following:

Contract Purchase Advance Advance
Hire Purchase Advance Advance
Hire Purchase Arrears
Finance Lease Advance

In the case of the first couple of lines I need to replace only 1 instance of 'Advance' not both. Is there anyway I could do this, I know the Replace() function does not replace only one instance, i.e.

Select Replace(ProductNames, 'Advance', '') from ProductList

Would removed both instances, could anyone help me please?

Thanks in Advance,

Reply With Quote
urstop urstop is offline
Junior Member
Join Date: Oct 2007
Location: London
Posts: 18
Is the repeated word in this case "Advance" always repeated word after word or it could be anywhere in the data?

If the repeatition is always word after word you can just modify your statement a bit like below

Select Replace(ProductNames, 'Advance Advance', 'Advance') from ProductList

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help. Getting a An error has occurred while establishing a connectionto the server. When connecting to SQL Server 2005, this failure may be causedby the fact that under the default settings SQL Server does not allow remote ASP .Net 0 05-03-2008 12:43 PM
SQL Server does not exist after moving to new Sql Server Geoff ASP .Net 3 01-16-2006 05:54 AM
Do the Self-Paced Training Kits: Microsoft SQL Server 2000 include Eval copy of SQL Server? Brian Whiting Microsoft Certification 2 12-29-2005 04:24 AM
sql server express vs sql server 2000 code Daves ASP .Net 1 06-13-2005 12:24 PM
Can't connect to SQL Server, using Windows Authentication users of SQL server? help =?Utf-8?B?UmV6YQ==?= ASP .Net 3 06-07-2004 06:42 PM