Go Back   Velocity Reviews > General Computer Discussion > Software
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
Old 11-29-2007, 11:27 AM   #1
Default Sql server REPLACE() question


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,

Steve


skb3
skb3 is offline   Reply With Quote
Old 12-03-2007, 12:31 PM   #2
urstop
Junior Member
 
Join Date: Oct 2007
Location: London
Posts: 20
Default
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


Regards,
UrStop


urstop
urstop is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prerequisites 70-745 (Business Intelligence) Valmont MCITP 3 06-24-2008 03:03 PM
SQL Server 2008 delayed into Q3 2008 darrilgibson@cox.net MCITP 0 01-27-2008 10:26 PM
MCITP SQL Server 2005 or SQL Server 2008 Darrilgibson@gmail.com MCITP 0 12-19-2007 01:56 PM
SQL Server 2005 Migration Assistant Autonumber problem. LarryWestMCSD MCTS 1 03-28-2007 02:08 AM
Re: Need Ideas For A New Server, Long Post Gareth Church A+ Certification 2 07-27-2003 12:46 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46