SQL statement - 'chop' phrase

  • hi guys how do i do this SQL statements when a user typed in search text field in my ASP.net webpage? How do I 'chop' the typed-in phrases?

    examples:

    1. typed in phrase: marketing assistant jobs

    the resulting SQL statement should be:

    SELECT field1,field2

    FROM myTable

    WHERE CONTAINS(*, 'marketing AND assistant AND jobs')

    2. typed in phrase: public administration

    the resulting SQL would be:

    SELECT field1,field2

    FROM myTable

    WHERE CONTAINS(*, 'public AND administration')

    3. typed in phrase: SQL server full text search

    result would be:

    SELECT field1,field2

    FROM myTable

    WHERE CONTAINS(*, 'SQL AND server AND full AND text AND search')

    thanks for any ideas.

    .

  • Does this help?

    select 'SQL full text search', replace('SQL full text search', ' ', ' AND ');

    You might consider giving BOL (Books Online, the SQL Server Help System) a shot. A good starting point mihgt be string functions.

    Edit: I tried this using variables, but it wouldn't post. Something here at work causes issues and it is frustrating.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply