Results 1 to 3 of 3

Thread: left trim

  1. #1
    amie Guest

    left trim


    What is the syntax of left triming characters seperated by space.

    e.g elsie reed
    and i want elsie to go to one field and reed in another field i do not want to use numbers because they don't all have the same numbers but are all seperated by spaces

  2. #2
    jkv Guest

    left trim (reply)

    Hi amie,
    I hope this helps:
    I suppose you have a field that contains a firstname and a lastname separated by space:

    select firstname = substring(yourcolumn , 1, charindex(' ',yourcolumn) -1 ),
    lastname = ltrim(substring(yourcolumn,charindex(' ',yourcolumn) + 1, len(yourcolumn)- len(substring(yourcolumn, 1, charindex(' ',yourcolumn) -1 ))))
    from yourtable




    ------------
    amie at 6/28/00 8:48:39 PM


    What is the syntax of left triming characters seperated by space.

    e.g elsie reed
    and i want elsie to go to one field and reed in another field i do not want to use numbers because they don't all have the same numbers but are all seperated by spaces

  3. #3
    amie Guest

    left trim (reply)

    Thanks


    ------------
    jkv at 6/29/00 3:06:43 AM

    Hi amie,
    I hope this helps:
    I suppose you have a field that contains a firstname and a lastname separated by space:

    select firstname = substring(yourcolumn , 1, charindex(' ',yourcolumn) -1 ),
    lastname = ltrim(substring(yourcolumn,charindex(' ',yourcolumn) + 1, len(yourcolumn)- len(substring(yourcolumn, 1, charindex(' ',yourcolumn) -1 ))))
    from yourtable




    ------------
    amie at 6/28/00 8:48:39 PM


    What is the syntax of left triming characters seperated by space.

    e.g elsie reed
    and i want elsie to go to one field and reed in another field i do not want to use numbers because they don't all have the same numbers but are all seperated by spaces

Posting Permissions

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