Logging Experiences

T-SQL: remove or replace line breaks

Posted in Programming, SQL, Tips and Tricks by Sina Iravanian on September 6, 2012

Sometimes you might need to remove line breaks from a column value to make a one-line data. I prefer to replace line-breaks with a single space, rather than removing them. This is how to do it with Transact-SQL:

REPLACE(REPLACE(ISNULL( SomeTable.SomeColumn, ''), CHAR(13), ''), CHAR(10), ' ')

To remove line-breaks completely replace the final space string with an empty string.

Advertisements
Tagged with: ,

6 Responses

Subscribe to comments with RSS.

  1. Claudia said, on March 27, 2013 at 9:34 am

    e – Pixel works as PHP Web Application Developers India since last many years.

    Smarty framework provides high-end, safe & secure web development
    solution, so it is widely used in various spheres.
    It is very effective for dynamic pages.

  2. Anonymous said, on December 17, 2014 at 5:41 pm

    Well done

  3. Anonymous said, on March 26, 2015 at 4:30 pm

    thnx dude!!!

  4. sandesh naik said, on September 22, 2015 at 12:34 pm

    Thanks mitra

  5. Anonymous said, on May 10, 2016 at 4:44 pm

    I think it worked for me… “for the love of god!”

  6. Brilliantag25t said, on February 12, 2017 at 11:27 am

    http://www.tvtalent.be/2013/08/04/rodzaje-wypadkow-drogowych-i-ich-klasyfikacja
    Purchasing a used or new car could be a difficult approach if you do not know what you really are performing. By educating yourself about vehicle buying before you decide to visit the dealer, you may make points less difficult for your self. The following advice might help your following shopping journey be more enjoyable.

    Usually take a mechanic along when buying a brand new vehicle. Car dealers are well known for marketing lemons and you may not need to be their next victim. Whenever you can not get yourself a technician to think about cars with you, no less than ensure that you have him evaluate your last decision before you purchase it.

    Know your limits. Before you begin purchasing for your forthcoming vehicle or vehicle, decide what you can manage to pay out, and adhere to it. Don’t overlook to incorporate interest in your estimations. You can expect to pay about twenty percent as a down payment also, so be prepared.

    Just before going to a car dealership, know which kind of car you need. Research all you alternatives ahead of buying to help you determine what works the best for your budget and household requires. Do your homework to determine just how much you must pay for any prospective auto.

    Before you sign any contract spend some time to go through each and every range, for example the small print. When there is something listed that you just do not comprehend, tend not to signal until you receive an response that you simply recognize. Unsavory salesmen are able to use a binding agreement to place several service fees that have been not discussed.

    In the event you keep the previous guidance at heart next time that you go shopping for a automobile, you will be very likely to get a better package. Investing in a automobile lacks to become a headache. Just use the information from this article and you will receive the automobile you desire at the good selling price.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: