split question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • peashoe

    split question

    Can anyone help me with a simple split problem. I've never done it
    before and I have no clue.

    I have value sSearch = Lastname Firstname

    I need to split it into two separate field:
    sLast = Lastname
    sFirst = Firstname

    I tried
    arrSearch = split(sSearch, " " )
    but how do I actually get the values?

    thanks in advance for your help
    Lisa

  • Aaron Bertrand [SQL Server MVP]

    #2
    Re: split question

    for i = 0 to ubound(arrSearc h)
    response.write i & " = " & arrSearch(i) & "<br>"
    next


    "peashoe" <peashoe@yahoo. com> wrote in message
    news:1150377080 .284479.133980@ u72g2000cwu.goo glegroups.com.. .[color=blue]
    > Can anyone help me with a simple split problem. I've never done it
    > before and I have no clue.
    >
    > I have value sSearch = Lastname Firstname
    >
    > I need to split it into two separate field:
    > sLast = Lastname
    > sFirst = Firstname
    >
    > I tried
    > arrSearch = split(sSearch, " " )
    > but how do I actually get the values?
    >
    > thanks in advance for your help
    > Lisa
    >[/color]


    Comment

    • peashoe

      #3
      Re: split question

      thanks Aaron,
      but I don't need to display the data. I just need to grab it so I can
      do a sql select to get other data. Therefore, I need to actually have
      two values:

      sLast and sFirst...

      Make sense?
      ~L~

      Comment

      • Aaron Bertrand [SQL Server MVP]

        #4
        Re: split question

        "peashoe" <peashoe@yahoo. com> wrote in message
        news:1150378032 .153406.112280@ i40g2000cwc.goo glegroups.com.. .[color=blue]
        > thanks Aaron,
        > but I don't need to display the data. I just need to grab it[/color]

        Okay, so don't response write, I was just showing you how to quickly see the
        data after the split.


        Comment

        • peashoe

          #5
          Re: split question

          the problem was I didn't know how to do it - but I found the answer on
          here anyway:

          arrSearch = split(sSearch, " ")

          this is what I didn't know how to do...
          sLast = arrSearch(0)
          sFirst = arrSearch(1)

          Thanks~!

          Comment

          Working...