I have 2 Tables - Raw_Data and Pivot. The E_MSG Column in Raw_Data contains a string of text in which I have provided a sample string for 4 entries below. I would like to filter out certain key words from E_MSG and insert the filtered key word into the 'Cause' Column in Pivot. Specifically, the key words I want to input into the pivot table are "Internet Outage", "Server Crash", and "Unknown Error" as seen below in the code.
How should I go about doing this?
I was thinking that it can be accomplished with a INSERT INTO statement followed by a NESTED Conditional inside of the WHERE Statement
Please note that I am new to SQL and still getting use to the syntax. Thanks.
CREATE TABLE Raw_Data (BOT_ID INTEGER PRIMARY KEY, E_MSG VARCHAR(1000));
INSERT Raw_Data VALUES(1, 'filler words 1234 Internet Outage');
INSERT Raw_Data VALUES(2, 'filler words 5678 Server Crash');
INSERT Raw_Data VALUES(3, 'filler words 1234 Internet Outage');
INSERT Raw_Data VALUES(4, 'filler words 9999 Unknown error');
CREATE TABLE Pivot (P_ID INTEGER PRIMARY KEY, Process VARCHAR(20), Cause
VARCHAR(20));
INSERT Pivot VALUES(1, 'AutoLoan', NULL);
INSERT Pivot VALUES(2, 'TFSA', NULL);
INSERT Pivot VALUES(3, 'eSig', NULL);
INSERT Pivot VALUES(4, 'mFunds', NULL);
You are looking for
CharIndex('Internet Outage', rd.E_MSG) > 0
use this to test whether or not your string contains what you are looking for
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.