Results 1 to 4 of 4

Thread: split string to individual word

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    split string to individual word

    sql enterprise manager (2000)

    i pass a variable to a stored procedure.

    the variable is
    @MsgTxt varchar(160),

    i have a table in the db which holds keywords in it.

    what i want to do is a check on each individual word contained within
    @MsgTxt
    for a match on my table table_keyword

    is this possible
    ---
    thankyou in advance for any replys
    it works 60% of the time, all the time.

  2. #2
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: split string to individual word

    you can use the split function in vb6 to achieve what you want.

    like this
    VB Code:
    1. Dim StrArray() as String
    2. Dim YourString As String
    3. YourString = "This is your String"
    4. StrArray = Split(YourString)
    the result would be
    StrArray(0) = "This"
    StrArray(1) = "is"
    StrArray(2) = "your"
    StrArray(3) = "String"
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: split string to individual word

    Quote Originally Posted by d3gerald
    you can use the split function in vb6 to achieve what you want.

    like this
    VB Code:
    1. Dim StrArray() as String
    2. Dim YourString As String
    3. YourString = "This is your String"
    4. StrArray = Split(YourString)
    the result would be
    StrArray(0) = "This"
    StrArray(1) = "is"
    StrArray(2) = "your"
    StrArray(3) = "String"
    I think he needs in T-SQL?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: split string to individual word

    cheers guys,
    i did want it in sql
    but i already had a function in place that split the string in the vb.net side

    then i run the stored procedure on each word.
    basically i am worried i am making an error on this process being 'heavy work'

    i.e. if the string has 15 words, i have to execute that stored procedure 15 times - program side.

    but i suppose i would have to check each word individually anyway to acheive this
    it works 60% of the time, all the time.

Posting Permissions

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



Click Here to Expand Forum to Full Width