Click here to Skip to main content
16,005,389 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have one table as follows.
C#
sno	name
1	george
2	michael
3	sturridge
4	bellamy
5	oliver kahn
6	torres
7	van persie
8	saurez
9	podolski

Now i have to insert a value and pass that value to one table by creating function. and then i have to Compare the newly inserted value with the name column in the above table. If both matches it should display the result as success,else fail.

Which is the best way to do this?
Posted
Updated 3-Sep-13 20:25pm
v2
Comments
syed shanu 4-Sep-13 2:59am    
Improve your question.not able to understand what you need

1 solution

Are you talking about two database tables, and when value is getting inserted in one, do a check against another table? If that is the case,

1. you could create a trigger on first table's insert. In it, check if the value exists in the other table and
if yes, continue with insert and print success message.
else cancel the operation and print failure message

2. You can also write a user defined function to this

Please specify more details to be able to give a solution.
 
Share this answer
 
Comments
ARUN K P 4-Sep-13 3:28am    
Yeah the same i m talking about the two database tables. ok i ll try with that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900