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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 search and replace

Author  Topic 

saini_balvinder
Starting Member

22 Posts

Posted - 2008-02-01 : 02:20:42
i have data in a table which is in format #12345;#22211;#12112; and so on... its a long string.

i want to replace only the numbers using nchar() function.
in above example i want to replace 12345, 22211, 12112 with nchar(12345), nchar(22211), nchar(12112).

i have managed to do this using loop and substring function. but now i have performance issue.

63K records will take many hours to update. i have to do following steps:
1. read record from table.
2. replace numbers with nchar() function.
3. update the same table with new text.

i have to do this using a stored procedure.

i am looking for some quick way to do this. any idea?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-02-01 : 03:21:59
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033

make use of the function there. If you are using SQL Server 2005 you can use the CROSS APPLY function with fnParseList. Not sure will it be any faster



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -