Geeks Talk

Prepare for your Next Interview




SQL, Compare then update a field after insertion

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 ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-07-2007
Banned
 
Join Date: Dec 2007
Location: kuwait
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
talalmanaa is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-19-2008
Junior Member
 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
am123 is on a distinguished road
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.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 01:44 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved