Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 Decmposition of the text inside a store procedure
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

5 Posts

Posted - 01/22/2014 :  11:36:49  Show Profile  Reply with Quote
I have a stored procedure (This SP is used to replace a n existing content with a new conetnt by searching for that content in a big text document ). The new conetnt and existing conetnt will be sent as parameters to the SP.
Consider the paramaters as
@oldContent varchar(100),
@newContent varchar(100),
@WholeContent varchar(500),
Inside the stored procedure , we have a replace function , which would be called
set @ WholeContent = REPLACE(@WholeContent, @oldContent, @newContent)
and it was working fine ,

Now there is a change in the business , the trick is that we are going to have multiple old values ( which will be sent as a single parameter)
The values that will be sent will be like below
For example ,
oldContent = ‘sa[abc]f[wes]’
newContent =’sam’
The new content will have only 1 value say ‘sam’
, but the old content can have different values , the old value sent in this example is sa[abc]f[wes]
Now we should be decompose the old content to saafw, sabfw,………..sacfs….(total 9)
Then we call the function replacefunction which replaces the oldconetnt( text created by all combination) with the new one.….
set @ WholeContent = REPLACE(@WholeContent, @oldContent, @newContent)
this should be called multiple times.

Just was looking how to implement this decomposition of the old values to different values and calling the replace function in a very efficient way .
Is there any build in function which can decompose the same and give different combination?


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/23/2014 :  07:13:01  Show Profile  Reply with Quote
duplicate of
please dont cross post

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000