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 9272363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:51:32+00:00 2026-06-18T15:51:32+00:00

I have a database filed named Account Type that has carriage return and newline

  • 0

I have a database filed named Account Type that has carriage return and newline characters in it (CHAR(10) and CHAR(13)).

When I search for this value I need to do a REPLACE as shown below. The following code works fine.

SELECT AccountNumber,AccountType, 
  REPLACE(REPLACE(AccountType,CHAR(10),'Y'),CHAR(13),'X') FormattedText 
FROM Account 
WHERE AccountNumber=200
AND REPLACE(REPLACE(AccountType,CHAR(10),' '),CHAR(13),' ') LIKE 
'%Daily Tax Updates:  -----------------        Transactions%'

My question is – what are the other characters (similar to CHAR(10) amd CHAR(13)) that would need such a replace?

Note: Data type for the column is VARCHAR.

Note: The query is run from SQL Server Management Studio

enter image description here

  • 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-18T15:51:34+00:00Added an answer on June 18, 2026 at 3:51 pm

    There are probably embedded tabs (CHAR(9)) etc. as well. You can find out what other characters you need to replace (we have no idea what your goal is) with something like this:

    DECLARE @var NVARCHAR(255), @i INT;
    
    SET @i = 1;
    
    SELECT @var = AccountType FROM dbo.Account
      WHERE AccountNumber = 200
      AND AccountType LIKE '%Daily%';
    
    CREATE TABLE #x(i INT PRIMARY KEY, c NCHAR(1), a NCHAR(1));
    
    WHILE @i <= LEN(@var)
    BEGIN
      INSERT #x 
        SELECT SUBSTRING(@var, @i, 1), ASCII(SUBSTRING(@var, @i, 1));
    
      SET @i = @i + 1;
    END
    
    SELECT i,c,a FROM #x ORDER BY i;
    

    You might also consider doing better cleansing of this data before it gets into your database. Cleaning it every time you need to search or display is not the best approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I have a database field named 'PROCESS_FLAG' that contains the text value
I have an account database on my Mac that uses HTML, Javascript & PHP
I have a calendar table in my MYSQL database with one field named datefield
I have set of flat files (114 files) each file is named with database
I have a web application that uses a local SQL Server Express database (a.k.a.
I have an Account object that contains an Id field, which is mapped to
Just after some advice regarding this database design situation. So I have two tables
I have a form that has several fields that are optional. When the mysql
Our SSDT database project includes a table that has a computed column that can
We have a large database on which we have DB side pagination. This is

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.