concat fields then search the new field

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default concat fields then search the new field

    how would I concatenate several fields from a record set then search the new
    field for individual keywords ?

    something like:

    Dim theArray

    for i = 1 to recSet.RecordCount
    theArray(i) = recSet("field1) & recSet("field2') etc
    next

    But then what statements would i use to search it ?

    Darren




    Darren Heinrich Guest

  2. Similar Questions and Discussions

    1. Search database fields using single text field
      Kindly advise on how to develop a database search page such that there is single text field to enter serach string and the results are shown on the...
    2. Concat two fields in SQL
      I am trying to concatenate two columns in an SQL statement but haven't been having much success: here is the portion of the SQL: ...
    3. Keyword search on 5 fields
      Hello group, I want to use one a keyword which will then automatically search 5 fields for the keyword and display any records with the keyword...
    4. dropdownlist-concat two fields-can it be done
      I am not sure how to, or even if you can do this. I have tried several things. I have a drop down list that is databound to a datareader. I wish...
    5. SQL Search Multiple Fields ??
      James wrote: Yes. Well, just execute this SQL statement using the PHP extension for the SQL server you're using. By the way: how does...
  3. #2

    Default Re: concat fields then search the new field

    Why do you want to bring the data back to the ASP page and then search it
    there? I think it would be more efficient to search the database at the
    database...

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Darren Heinrich" <dazzjazz@ozemail.com.au> wrote in message
    news:cTEUb.189$J9.3209@nnrp1.ozemail.com.au...
    > how would I concatenate several fields from a record set then search the
    new
    > field for individual keywords ?
    >
    > something like:
    >
    > Dim theArray
    >
    > for i = 1 to recSet.RecordCount
    > theArray(i) = recSet("field1) & recSet("field2') etc
    > next
    >
    > But then what statements would i use to search it ?
    >
    > Darren
    >
    >
    >
    >

    Aaron Bertrand [MVP] Guest

  4. #3

    Default Re: concat fields then search the new field

    I don't know - sorry I'm a part timer !!!
    Should I be making a temp table or something ?

    Darren


    "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
    news:OttzmVH7DHA.3008@TK2MSFTNGP09.phx.gbl...
    > Why do you want to bring the data back to the ASP page and then search it
    > there? I think it would be more efficient to search the database at the
    > database...
    >
    > --
    > Aaron Bertrand
    > SQL Server MVP
    > [url]http://www.aspfaq.com/[/url]
    >
    >
    >
    >
    > "Darren Heinrich" <dazzjazz@ozemail.com.au> wrote in message
    > news:cTEUb.189$J9.3209@nnrp1.ozemail.com.au...
    > > how would I concatenate several fields from a record set then search the
    > new
    > > field for individual keywords ?
    > >
    > > something like:
    > >
    > > Dim theArray
    > >
    > > for i = 1 to recSet.RecordCount
    > > theArray(i) = recSet("field1) & recSet("field2') etc
    > > next
    > >
    > > But then what statements would i use to search it ?
    > >
    > > Darren
    > >
    > >
    > >
    > >
    >
    >

    Darren Heinrich Guest

  5. #4

    Default Re: concat fields then search the new field

    Darren Heinrich wrote:
    > how would I concatenate several fields from a record set then search
    > the new field for individual keywords ?
    >
    > something like:
    >
    > Dim theArray
    >
    > for i = 1 to recSet.RecordCount
    > theArray(i) = recSet("field1) & recSet("field2') etc
    > next
    >
    No, don't do that. Let the database do it:

    Select ...
    WHERE [field1] & [field2] LIKE "%searchword%"

    HTH,
    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  6. #5

    Default Re: concat fields then search the new field

    > Should I be making a temp table or something ?

    What would a temp table do for you? SEARCH THE TABLE. You seem to be going
    out of your way, in all of your posts, to re-invent the wheel.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139