Results 1 to 3 of 3

Thread: String Manipulation

  1. #1
    Join Date
    Mar 2006
    Posts
    127

    String Manipulation

    Hi All,

    I am trying to break the string that looks like this


    2007-05-06 07:36:21.28 server Copyright (C) 1988-2002 Microsoft Corporation.
    2007-05-06 07:36:21.28 server All rights reserved.
    2007-05-06 07:36:21.28 server Server Process ID is 292.

    into three separate strings to look like this

    col1 col2 col3
    2007-05-06 07:36:21.28 server Copyright (C) 1988-2002 Microsoft Corporation.
    2007-05-06 07:36:21.28 server All rights reserved.
    2007-05-06 07:36:21.28 server Server Process ID is 292.


    I was able to separate the above string into two columns, but can't figure out how to put the rest of the string into the third column.

    Any help is appreciated.

    Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can use charindex to find the first and second blank space and do substring.

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Or looking at the sample data, it looks like the first two columns are fixed width. If that is true for rest of the data then you can use substring to break them without using charindex.

Posting Permissions

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