Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to replace first occuracne of a expression. Expand / Collapse
Author
Message
Posted Friday, March 14, 2014 12:08 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, December 3, 2014 10:04 PM
Points: 52, Visits: 161
Hi,

REPLACE function will replace all occurrence of any expression.

is there any thing which can replace only first occurrence ,

and is there any thing which can only search matchwholeword.


yours sincerly


Post #1551020
Posted Friday, March 14, 2014 12:38 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 2:56 AM
Points: 2,603, Visits: 2,061
I guess you can achieve this through IF..ELSE and WHERE clause.

HTH


---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Post #1551030
Posted Friday, March 14, 2014 7:27 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:05 PM
Points: 13,327, Visits: 12,820
rajemessage 14195 (3/14/2014)
Hi,

REPLACE function will replace all occurrence of any expression.

is there any thing which can replace only first occurrence ,

and is there any thing which can only search matchwholeword.


yours sincerly




CHARINDEX and SUBSTRING should be able to do this for you.

If you can elaborate a little more on your requirements we can probably help.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1551152
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse