Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012

    Unanswered: Adding Character In Between A String

    Hi All,

    Appreciate if one of you can tell me how to achieve the following or direct me to already existing thread.

    Basically I need to insert underscore in between a string when there is a space in the content of the string. For Example say we have string 'ABC XYZ', I've to convert it into something like this 'ABC_XYZ'. Some strings do not have space in between and I should not add underscore in such cases. I'm working with MSSQL Server 2008 version.

    Thanks for your reply in advance.


  2. #2
    Join Date
    Apr 2012

    Try something like that:

    select REPLACE(MyColumn, ' ', '_') as MyColumn from MyTable
    Hope this helps.

  3. #3
    Join Date
    May 2012
    It is working.

    Thanks Imex for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts