Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    51

    Red face Unanswered: Separate columns

    Hi to all of you,

    I am new to SQL I have a problem that I can’t solve.
    I have a column with Surname and name (SMITH, James) in one table with data I just need to separate in two columns in one Surname in the other one Name I know how to unite two columns using substrings but not to separate in two columns.

    Help is highly appreciated

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Do you have SQL Server books online?

    Look up CHARINDEX
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2005
    Posts
    51

    Red face

    Many Thanks on your reply,

    I found this:
    USE pubs
    GO
    SELECT CHARINDEX('wonderful', notes)
    FROM titles
    WHERE title_id = 'TC3218'

    But still no idea for the solutions.

    Best regards,

  4. #4
    Join Date
    Dec 2002
    Posts
    1,245
    Do a google on fn_Split()

    As for CHARINDEX, do a search on this site. Or just hit this link here. I just answered a similar question today.

    Regards,

    hmscott
    Have you hugged your backup today?

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    This function will parse just about any western name you throw at it:
    Attached Files Attached Files
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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