SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

sarfrazabdu
Starting Member

Canada
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.….
So,
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?


sarfraz

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 01/23/2014 :  07:13:01  Show Profile  Reply with Quote
duplicate of
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=190872
please dont cross post

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000