Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    Melbourne
    Posts
    144

    Unanswered: String Manipulation

    Field1 = Dominguez Public Transport Division 03 9320 4326

    how do i remove these strings in T-SQL

    Field1 = Dominguez
    Field2 = Public Transport Division
    Field3 = 03 9320 4326

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Are there consistent rules that can be used to reliably parse all the strings in your column? Such as: Field1 = First Word, Field2 = Next Three Words, Field3 = Last Three Words?
    If it's not practically useful, then it's practically useless.

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

  3. #3
    Join Date
    Apr 2004
    Location
    Melbourne
    Posts
    144
    yeah i think that's the general idea.

    i actually got all the data from an email notification system which i then imported to excel which caused all the formatting problems.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You are going to need to do some cumbersome parsing using SQL Server's built-in string functions. Particularly, you will want to use the LEFT(), CHARINDEX(), and SUBSTRING() functions to search for occurances of the space character and peel off the text between them.
    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
  •