Tuesday, February 23, 2010

Using SQL Remove the Last character in a String

There are cases when we may need to remove only the last character after we have done some concatenation.
In SQL Query we can do it using Substring and Left

Substring

SUBSTRING (Text,Start_From,Till_lenght)

Remove a comma, at the end of the string

Eg: select substring('1,2,3,4,5,', 1, (len('1,2,3,4,5,') - 1))

LEFT :
LEFT gives and output of the string from starting to end

Eg: SELECT LEFT(String, LEN(String) - 1)

The same can be used to trim data from the Right
Eg: SELECT RIGHT(String, LEN(String) - 1)

23 comments:

  1. nice post dear

    ReplyDelete
  2. thnx bro dat hlpd me....

    ReplyDelete
  3. Hello! It seems as though we both have a passion
    for the same thing. Your blog, "Blogger: just blogging" and mine are very similar.

    Have you ever thought about authoring a guest write-up for
    a related website? It will definitely help gain publicity to your
    website (my site recieves a lot of traffic).
    If you're interested, e-mail me at: nathan_shook@wildmail.com.
    Many thanks
    Have a look at my blog post :: Injury Lawyers

    ReplyDelete
  4. Asking questions are genuinely fastidious thing if you are not understanding anything fully, but this paragraph presents good understanding yet.
    My web site > how to get rid of acne overnight

    ReplyDelete
  5. Way cool! Some extremely valid points! I appreciate you
    penning this write-up and the rest of the site is also very
    good.
    Feel free to surf my web-site - yahoodiary.com

    ReplyDelete
  6. When I initially commented I clicked the "Notify me when new
    comments are added" checkbox and now each time a comment is added I get several e-mails with the same comment.

    Is there any way you can
    remove me from that service? Many thanks!

    my webpage Go to my website

    ReplyDelete
  7. Good day! Do you know if they make any
    plugins to assist with Search Engine Optimization? I'm trying to get my
    blog to rank for some targeted keywords but I'm not seeing very good results.
    If you know of any please share. Cheers!

    Take a look at my web site ... Go to my website

    ReplyDelete
  8. In most cases SELECT LEFT(String, -1) will also work.

    ReplyDelete
  9. So, start today and rid yourself of those annoying and unsightly growth.

    An individual can develop anywhere from 1 to well over 100 skin tags.
    You will find that your custom shapes are now available from the shape menu when you
    have the Custom Shape Tools selected.

    Feel free to visit my web-site ... skin tags home remedy

    ReplyDelete
  10. When you have both skin tags as well as warts
    on your body, you can use the skin tag removal products that will also help you
    to remove the skin warts. The good news is that normally they are benign tumors that
    won't affect your health. 'We usually have two or three people in the room,
    no-one has time, so we have one person tightening the body
    and another giving a treatment on the face'.

    My blog http://lotustours.net/forum/member.php?action=profile&uid=174578

    ReplyDelete
  11. First of all, unlike having to eat 6 times per day every day your training should only be done 1 time per day 3 days
    per week with at least one day of rest between training
    days. In this article you will find out why people are working towards
    gaining weight and what the right ways to accomplish this are.

    s true that the Internet is filled with a lot of information and tips about getting
    the kind of body you want however most of us find it very challenging just to be able to stick
    to a weight gain training program that will eliminate the question of how to
    gain weight for women once and for all.

    Feel free to surf to my page how to gain weight for women fast (howtogainweighthq.org)

    ReplyDelete
  12. It might not create the dimple for you, but it does make the tie more manageable.
    The tackle is going to require an initial investment but the
    cost per hair rig will work out far less than buying them
    ready made from a fishing tackle shop. The self-tie bow ties is a test of skill in tying it.


    Also visit my web blog how to to tie a tie ()

    ReplyDelete
  13. Choose your pokemon and search for its different poses.

    On the flat high of the figure, make 4 extending lines for the
    fingers. Then draw two circles inside for the eyes, usually chibi eyes are
    big.

    my page ... how To Draw anime

    ReplyDelete
  14. I see a lot of guys ask how to put on weight but at the
    same time are missing the most obvious step - they aren't eating enough. In this article you will find out why people are working towards gaining weight and what the right ways to accomplish this are. Make sure your kitchen is fully stocked with the foods you need to eat.

    Have a look at my website - how to gain weight fast for girls ()

    ReplyDelete
  15. There are a lot of online services that help you with internet marketing search engine
    tips. If you know what text you want to appear there
    now, go ahead and make that change. However, the design elements can still
    be kept same, without affecting the user experience a
    great extent.

    my blog; how to make a photography website for free

    ReplyDelete
  16. When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each
    time a comment is added I get four e-mails with the same comment.
    Is there any way you can remove people from that service?
    Many thanks!

    my blog - aa batteries []

    ReplyDelete
  17. Thank you for the auspicious writeup. It in fact was a
    amusement account it. Look advanced to far added agreeable from you!
    By the way, how can we communicate?

    Also visit my webpage :: bear river insurance utah

    ReplyDelete
  18. Hello! I just wanted to ask if you ever have any issues with hackers?
    My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to
    no data backup. Do you have any solutions to stop hackers?


    Visit my weblog curing acne

    ReplyDelete


  19. Review my web-site quad marrakech apple apple store new haven ct phone number (www.jnco.gov.jo)

    ReplyDelete
  20. It can also function as an accesѕ point and ann adapter.

    In less than an hour they are woken up by a knock at the door.
    If we alwayys haave a joke while we are traveling, everytɦing
    iin our traѵel lightens սp.

    Feeel free to visit my weblog: 0, ,

    ReplyDelete
  21. I am not sure where you're getting your info, but great topic.

    I needs to spend some time learning more or understanding more.

    Thanks for wonderful info I was looking for this information for my mission.

    Look at my web page; escort in bali - http://hebu.it/ -

    ReplyDelete
  22. Good information. Lucky me I discovered your website by chance (stumbleupon).
    I've book-marked it for later!

    Feel free to visit my web page godaddy customer

    ReplyDelete
  23. That is certainly also the reason why hybrid cars are so quiet
    why it truly is stationary. It is intended to be the greatest companion for amateur motorists, as it is
    easy to journey on busy streets.

    My weblog - auto warranty ()

    ReplyDelete

Express you views