Home > Alter, ASCII, Joins, SQL Queries, SQL Server, T-SQL > Insert “Space”,”new line”,”tab” characters into a field as value

Insert “Space”,”new line”,”tab” characters into a field as value

There are times when you need to insert some special characters such as “newline”,”tab” etc as values into a field. Usually every one tries with ‘\n’ or ‘\t’, in vain. we can do this by using the ASCII value of the character. The steps are very simple. if you want to insert a special character find the ASCII value of that character like ‘ 9 for tab’, ‘ 12 for new line’ etc. you can find the lists of characters with its ASCII values at https://awesomesql.wordpress.com/2009/08/10/ascii-character-set-table. Once this is done, concatenate your string with the character of that particular ASCII value as

‘my string and’+ char(12)+’someting’

this will be

my string and

something

Read More . . . . 

 

 

Advertisements
  1. Magda
    February 25, 2011 at 10:16 am

    the idea of checking ASCII code was very useful. thanks! :)

  2. July 16, 2011 at 7:56 pm

    I knew how to do this, but the ability to use the cheatsheet at the bottom instead of an ascii chart lead to ultimate laziness.

  3. bbooky
    January 18, 2012 at 7:57 pm

    BookGrill – free ebooks
    http://goo.gl/KGegI

    Free books

  4. May 31, 2013 at 5:34 am

    In fact, it is within the price range that is estimated for other impressive
    tablets that can be found in the market. It has a 2-megapixel
    rear-facing camera and a 5-megapixel front-facing one.

    Customers seeing those two price points might hesitate to buy Microsoft’s option.

  5. June 1, 2013 at 12:51 pm

    Wonderful article! We are linking to this particularly great content
    on our website. Keep up the good writing.

  6. June 4, 2013 at 2:39 am

    Hey! This is my first visit to your blog! We are
    a team of volunteers and starting a new initiative in a community in the same
    niche. Your blog provided us beneficial information to work
    on. You have done a marvellous job!

  7. February 13, 2014 at 10:46 am

    Some of the examples in the last box using the octal value instead of the decimal one.
    LF = Line Feed = Char(10)
    CR = Carriage Return = Char(13)
    VT = Vertical Tab = Char(11)

  8. February 27, 2014 at 5:50 pm

    Good day! I simply wish to give you a big thumbs up for your excellent information you have here on this post.
    I will be coming back to your website for more soon.

  9. Qamar Abbas
    July 21, 2014 at 3:54 am

    Thanks I was facing the same problem. You solved it. Thanks….

  10. January 21, 2016 at 1:45 am

    I was seeking this certain info for a long time. Thanks and best of luck.

  1. October 2, 2009 at 1:30 am

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: