sql server - How to Replace Multiple Characters in SQL? -


This is based on a similar query

I wrote because there is a limit in SQL Server 2005

I have the following tasks: A match is required on the column, and using several non-essential characters to improve the probability of a match () function

 < Code> DECLARE @es NVarChar (1) SET @es = '' DECLARE @ p0 NVarChar (1) SET @ p0 = '!' DECLARE @ P1 NVarChar (1) SET @ P1 = '@' --- etc ... SELECT * FROM T1, T2 WHERE REPLACE (REPLACE (t1.stringkey, @ p0, @es), @ p1, @s ) = Replaced (T. 2. Strickki, @ P, @ AS), @ P1, @ AS) --- etc  

if there> 19 relays () that Section, so this does not work, so the solution I came up with in this example is to create a SQL function named Trim Chairs (excuse them @ 22

  Construction work [trimchars] (@ string) Varchar (max)) Return varchar (max) AS DECLARE @ES NVarCha R (1) SET @es = '' DECLARE @ p22 NVarChar (1) SET @ P22 = '^' DECLARE @ p23 NVarChar (1) SET @ p23 = '& Amp;' DECLARE @ p24 NVarChar (1) SET @ P24 = '*' DECLARE @ p25 NVarChar (1) SET @ p25 = '(' DECLARE @ p26 NVarChar (1) SET @ p26 = '_' DECLARE @ p27 NVarChar (1 ) SET @ p29 = '~' DECLARE @ P30 NVarChar (1) SET @ p30 = {SET @ P27 = '' 'DECLARE @ p28 NVarChar (1) SET @ p28 =' `DECLARE @ p29 NVarChar (1) 'DECLARE @ p31 NVarChar (1) SET @ p31 ='} 'DECLARE @ p32 NVarChar (1) SET @ p32 =' 'DECLARE @ p33 NVarChar (1) SET @ p33 =' ['DECLARE @ p34 NVarChar (1) SET @ P34 = '?' DECLARE @ p35 NVarChar (1) SET @ P35 = ']' DECLARE @ P36Navarkar (1) SET @ P36 = '\' DECLARE @ p37 NVarChar (1) SET @ p37 = '|' DECLARE @ P38 Encounter (1) SET @ p3838 = '& lt;' DECLARE @ p39Anvarkar (1) SET @ P39 = '& gt; DECLARE @ p40 NVarChar (1) SET @ p40 = '@' DECLARE @ p41 NVarChar (1) SET @ p41 = '-' Return response (replays (replays (replays (replays (replays (replaces) (replays (replaces (replication Repless (Replice (Ripples (Ripples (Ripples (Ripples (Ripples (Ripples (Ripples (Ripples (Riples (Riplice (@ string, @ P22, @s), @ P23, @ AS), @ P24, @ s) @ P-25, @ AS), @ P27, @As., @P28, @As.), @ P29, @As., @P30, @ AS), @ P31, @ AS, @P32 , @ PIS, @ AS), @ P34, @ AS35, @ P35, @ AS, @ P36, @ AS), @ P37, @ AS), @ P38, @ AS , @ P3 9, @ AS), @ P4, @ AS), @ P41, @EED  

It can be used in addition to other string strings

  select from * T1, T2, WHERE trim chairs (replication (replication (T.strinkie, @ P, @ AS), @ P1, @ AS) = reps (Replay (t 2. StringKi, @ P, @ AS), @ P1, @s))  

I have made some other functions to do something like trim chairs ( Trimmor Chars (

  SELECT * T1, T2 WHERE We Chers (Trimmoar chars (Riplais (Riplais (T1. Stringky, @ P1, @ Es), @ P1, @ ES) = REPLACE (replication (T. stringkey, @ P, @ AS), @ P1, @ AS)))  

Can someone tell me better solution to this problem in terms of performance and maybe cleaner implementation?

I will seriously consider and do regular searches and replace for a range of characters Expression (both strings and patterns can be passed as parameters) should be easily overcome this SQL UDF.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -