DECLARE @SearchStr varchar( 30 ) , @SearchBin varbinary( 30 ) SELECT @SearchStr = 'AdministraciÓón' , @SearchBin = CONVERT( varbinary( 30 ) , @SearchStr ) PRINT 'Original String : ' + @SearchStr
SE @SearchStr = STUFF( @SearchBin , CHARINDEX( CONVERT( binary(1) , 'Ó' ) , @SearchBin ) , 1 , CONVERT( binary(1) , 'O') ) PRINT 'After Replace #1: ' + @SearchStr
SELECT @SearchBin = CONVERT( varbinary( 30 ) , @SearchStr ) SELECT @SearchStr = STUFF( @SearchBin , CHARINDEX( CONVERT( binary(1) , 'ó' ) , @SearchBin ) , 1 , CONVERT( binary(1) , 'o') ) PINT 'After Replace #2: ' + @SearchStr
DECLARE @SearchStr varchar( 30 ) , @SearchBin varbinary( 30 ) , @CharBin binary( 1 ) SELECT @SearchStr = 'AdministraciÓón de Operación' SELECT @SearchBin = CONVERT( varbinary( 30 ) , @SearchStr ) SELECT @CharBin = CONVERT( binary(1) , 'Ó' ) WHILE CHARINDEX( @CharBin , @SearchBin ) > 0 SELECT @SearchBin = CONVERT( varbinary( 30 ) , STUFF( @SearchBin , CHARINDEX( @CharBin , @SearchBin ) , 1 , CONVERT( binary(1) , 'O') ) )
SELECT @CharBin = CONVERT( binary(1) , 'ó' ) WHILE CHARINDEX( @CharBin , @SearchBin ) > 0 SELEC @SearchBin = CONVERT( varbinary( 30 ) , STUFF( @SearchBin , CHARINDEX( @CharBin , @SearchBin ) , 1 , CONVERT( binary(1) , 'o') ) ) SELECT @SearchStr = CONVERT( varchar( 30 ) , @SearchBin ) PRINT @SearchStr |