Column with keywords found in comments field

Database

Column with keywords found in comments field

At work I've been given a task that I'm told is "simple and straightforward", but I'm having difficulty with:

I have a view that contains 4 columns, a PK, FK, comments, and column #4. My manager is telling me to make a separate table that contains 75 or so keywords, and then a query that will go through each row in the view, compare the comments to the keyword table, and then append each found keyword to column #4. I've searched google and SO, and have not found a query that would do this, and haven't been able to figure out a way to do this myself beyond a lot of case and index statements, which I end up running into spool issues with. Any help would be appreciated.

1 REPLY
Ckp
Enthusiast

Re: Column with keywords found in comments field

Can you post sample data from your view and output you expect as it will make your requirement more clear.

Also I am not sure about Teradata on this but you can do it with a combination of Bteq inside unix scripts.

1. Generate a list of keyword table

2. Store view definition in a txt file

3. Use a loop that will loop through through the content of keywordTable.list

4. Inside the loop use grep command to match the comments.

5. Store the all the cols alongwith the new Col#4 in a txt file

6. You can later insert this txt file in a table.