title: How to replace small alpha characters only to double byte using SQL Server
body: <p>How to replace the small alpha characters only in SQL Server? For example If I have a text <code>A Simple Man</code>. The text should be replace to <code>A Söнрмï Mæо</code>. I use the script below the problem is the big letter was replaced also.</p>
  
  <pre><code>ALTER FUNCTION [dbo].[sf_ReplaceCharacters] (@string NVARCHAR(MAX))
  RETURNS NVARCHAR(MAX)
  AS
  BEGIN
      DECLARE @tmpString NVARCHAR(100)
      SET @tmpString = @string 
      set @tmpString=replace(@tmpString,N'a',N'æ')
      set @tmpString=replace(@tmpString,N'b',N'в')
      set @tmpString=replace(@tmpString,N'c',N'г')
      set @tmpString=replace(@tmpString,N'd',N'д')
      set @tmpString=replace(@tmpString,N'e',N'ï')
      set @tmpString=replace(@tmpString,N'f',N'ж')
      set @tmpString=replace(@tmpString,N'g',N'з')
      set @tmpString=replace(@tmpString,N'h',N'и')
      set @tmpString=replace(@tmpString,N'i',N'ö')
      set @tmpString=replace(@tmpString,N'j',N'к')
      set @tmpString=replace(@tmpString,N'k',N'л')
      set @tmpString=replace(@tmpString,N'l',N'м')
      set @tmpString=replace(@tmpString,N'm',N'н')
      set @tmpString=replace(@tmpString,N'n',N'о')
      set @tmpString=replace(@tmpString,N'o',N'Ą')
      set @tmpString=replace(@tmpString,N'p',N'р')
      set @tmpString=replace(@tmpString,N'q',N'с')
      set @tmpString=replace(@tmpString,N'r',N'т')
      set @tmpString=replace(@tmpString,N's',N'у')
      set @tmpString=replace(@tmpString,N't',N'ф')
      set @tmpString=replace(@tmpString,N'u',N'Č')
      set @tmpString=replace(@tmpString,N'v',N'ц')
      set @tmpString=replace(@tmpString,N'w',N'ч')
      set @tmpString=replace(@tmpString,N'x',N'ш')
      set @tmpString=replace(@tmpString,N'y',N'щ')
      set @tmpString=replace(@tmpString,N'z',N'ъ')
      RETURN @tmpString
  END
  </code></pre>