Tech Off Post

Single Post Permalink

View Thread: hopefully simple t-sql question
  • User profile image

    Matthew van Eerde said:
    ferguslogic said:
    Yeah this question screams "dynamically built SQL" to me.

    My suggestion: sanitize the input in the CGI to be word-ish tokens seperated by, oh, say, commas: @input = 'foo,bar,baz'

    Then write T-SQL to loop over the input and build up the WHERE clause:
    WHERE field like '%foo%' or field like '%bar%' or field like '%baz%'

    Even without full-text searching, this should be doable if you have some good hardware, not very many tickets, and relatively infrequent queries.
    thanks for all the assistance everyone.