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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:44:47+00:00 2026-06-01T15:44:47+00:00

Facing a problem, it seems my data stored in SQL Server does not stored

  • 0

Facing a problem, it seems my data stored in SQL Server does not stored correctly, simply put, how to verify that a varchar data has carriage return and line feed in it? I try to print them out, does not show the special characters.
Thanks

  • 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-01T15:44:48+00:00Added an answer on June 1, 2026 at 3:44 pm

    You can use SQL Server’s char(n) and contains() functions to match on field contents in your WHERE clause.

    carriage return: char(13)
    line feed:       char(10)
    

    The following SQL will find all rows in some_table where the values of some_field contain newline and/or carriage return characters:

    SELECT * FROM some_table 
    WHERE CONTAINS(some_field, char(13)) OR CONTAINS(some_field, char(10)) 
    

    To remove carriage returns in your some_field values you could use the replace() function long with char() and contains(). The SQL would look something like:

    UPDATE some_table 
    SET some_field = REPLACE(some_field, char(13), '')
    WHERE CONTAINS(some_field, char(13))
    

    To remove new lines you can follow up the last statement with the char(10) version of that update. How you do it all depends on what types of newlines your text contains. But, depending on where the text was inserted/pasted from the new lines may be \r\n or \n so running updates against both \r and \n characters would be safer than assuming that you’re getting one version of newline or the other.

    Note that if the newlines were removed and you want to retain them then you have to fix the issue at the point of entry. You can’t replace or fix what has been removed so you should save the original text data in a new column that holds the original, unmodified text.

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

Sidebar

Related Questions

I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map
I'm facing a problem that I assumed would be very easy to solve but...
I have a .NET 2.0 server that seems to be running into scaling problems,
I'm quite new to Django Forms, and I'm facing a problem that I cannot
I have a client/server application that depends on MS SQL database for backend storage,
Has anyone got any tips for this problem i'm facing. Its not complex, but
I writing an application that pushes data over an external service to some server.
I am facing problem with an Oracle Query in a .net 2.0 based windows
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file
i am facing problem with ipv6 validations and ipv4 validations in JavaScript please help

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.