Prepare for your Next Interview
This is a discussion on SQL, Compare then update a field after insertion within the SQL forums, part of the Databases category; I have two tables in SQL: tbl_names, and tbl_insert. the field named: tbl_names.field_dictionary contains names. the tbl_insert contains many fields and one of them is called tbl_insert.field_keywords and ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
SQL, Compare then update a field after insertion
I have two tables in SQL: tbl_names, and tbl_insert.
the field named: tbl_names.field_dictionary contains names. the tbl_insert contains many fields and one of them is called tbl_insert.field_keywords and another 2 fields called tbl_insert.field_title and tbl_insert.field_details. now my question is the following: I need a stored procedure code to tell sql every time I insert a record in tbl_insert i want the sql to compare tbl_names.field_dictionary against tbl_insert.field_title and tbl_insert.field_details ; if those two fields contains the keywords listed in tbl_names.field_dictionary; i need to insert/update the field named: tbl_insert.field_keywords by inserting only the founded keywords inside the tbl_names.field_dictionary into the tbl_insert.field_keywords without repeating the words found inside the field. I hope someone can help me in providing me with this code, take it as a challange. Last edited by talalmanaa : 12-07-2007 at 11:38 AM. Reason: type error |
| Sponsored Links |
|
|||
|
Re: SQL, Compare then update a field after insertion
You can compare by using before insert trigger, by putting your stored procedure code inside the trigger on table tbl_insert. Even you can use after insert trigger, check the content of inserted value with field_dictionary of the tbl_names table, if it is matching, commit the changes else rollback.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is there any way to compare the runtime value with the actual value | Geek_Guest | QTP | 3 | 05-23-2008 01:22 PM |
| Compare CSV files | rahul.malhotra | Geeks Lounge | 0 | 11-22-2007 02:05 AM |
| Can I manipulate in terms of insertion in an online grid? | Geek_Guest | ASP.NET | 0 | 07-13-2007 11:55 PM |
| Compare utility against two table | anand.kr.singh | Oracle | 3 | 02-19-2007 01:46 AM |
| Field, single field and multivalue field | JobHelper | Seibel | 1 | 01-10-2007 12:54 PM |