Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:19:38+00:00 2026-06-06T17:19:38+00:00

I want to replace any latin / accented characters with their basic alphabet letters

  • 0

I want to replace any latin / accented characters with their basic alphabet letters and strip out everything that cant be converted

examples:

'ë' to be replaced with 'e'
'ß' to be replaced with 's' , 'ss' if possible, if neither then strip it

i am able to do this in c# code but im just not well experienced in MSSQL to solve this without taking many days

UPDATE: the data in the varchar column is populated from a trigger on another table which should have normal UNICODE text. i want to convert the text to ascii7 in a function to use for further processing.

UPDATE: i prefer a solution where this can be done in SQL only and avoiding custom character mapping. can this be done, or is it currently just not possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:19:39+00:00Added an answer on June 6, 2026 at 5:19 pm

    As Aaron said, I don’t think you can dispose of mapping tables entirely in SQL, but mapping characters to ASCII-7 should involve some fairly simple tables, used in conjunction with AI collations. Here there are two tables, one to map characters in the column, and one for the letter of the alphabet (which could be expanded if necessary).

    By using the AI collations, I get around a lot of explicit mapping definitions.

    -----------------------------------------------
    -- One time mapping table setup
    CREATE TABLE t4000(i INT PRIMARY KEY);
    GO
    
    INSERT INTO t4000 --Just a simple list of integers from 1 to 4000
    SELECT ROW_NUMBER()OVER(ORDER BY a.x)
    FROM (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10)) a(x)
    CROSS APPLY (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10)) b(x)
    CROSS APPLY (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10)) c(x)
    CROSS APPLY (VALUES(1),(2),(3),(4)) d(x)
    GO
    
    CREATE TABLE TargetChars(ch NVARCHAR(2) COLLATE Latin1_General_CS_AI PRIMARY KEY);
    GO
    
    INSERT TargetChars -- A-Z, a-z, ss
    SELECT TOP(128) CHAR(i)
    FROM t4000
    WHERE i BETWEEN 65 AND 90
        OR i BETWEEN 97 AND 122
    UNION ALL
    SELECT 'ss'
    -- plus any other special targets here
    GO
    
    -----------------------------------------------
    -- function
    CREATE FUNCTION dbo.TrToA7(@str NVARCHAR(4000))
    RETURNS NVARCHAR(4000)
    AS
    BEGIN
        DECLARE @mapped NVARCHAR(4000) = '';
        SELECT TOP(LEN(@str))
        @mapped += ISNULL(tc.ch, SUBSTRING(@str, i, 1))
        FROM t4000
        LEFT JOIN TargetChars tc ON tc.ch = SUBSTRING(@str, i, 1)
        COLLATE Latin1_General_CS_AI;
    
        RETURN @mapped;
    END
    GO
    

    Usage example:

    SELECT dbo.TrToA7('It was not á tötal löß.');
    

    Result:

    --------------------------
    It was not a total loss.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any time I want to replace a piece of text that is part of
I have string like [any characters]{$\prime$}[any characters]$[any characters]{$\prime$}[any characters]$[any characters] I want to replace
I want to replace any twitter @UserName with a {UserName}. I now have the
Is there any better way than the following? Particularly, I want to replace Activator
I want to edit (for example, replace any placeholder by any text) a rtf
I want to replace any one of these chars: % \ , [ ]
I want to replace any content in my text file in between symbols <
I want to replace everything except the following: spaces ( ) numbers AND OR
I want to replace any string before /, irrespective of the string length. Thanks
Using JavaScript and I want to replace any text between @anytext@ with some text.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.