can anyone tell me,how to create a trigger that check all records present in a particular table and allow saving the data only when the record(identified by a primary key) does not exist and if the record exist then show a message-record already exist,cnt save.
Thnks For Replying
Actually The Problem Is::::: Id Is Actually A Forigen Key In One Of My Table.it Is Accepting Mutilple Entries Of A Single Id,which I Dnt Want..for Example Id Is 'tro1',it Is Making Mutliple Entries In The Table Each Time When I Press Save Button.
But I Want To Do Only One Entry For 'tro1',the Next Time Is Try To Make Same Attempt,it Should Show A Message U Cnt Insert The Record As It Exist Already.
I thougth a long time whether I should answer this or not.
But I finally decided if I don't, you wouldn't know why.
Please try to write a bit more clearly, using line breaks and proper upper/lowercase and do not abbreviate words.
For people who do not speak English as a native language this "IM Talk" is hardly understandable
Writing with correct capitialization is simply a matter of courtesy, especially because you are asking volunteers to help you for free.
The above paragraphs in your way of writing would look like this:
I Thought A Long Time.. Whether I Shud Ans This Or Not.... But ::: I Finally Decided,If I Dont U Won't Know Why.... Pls:::::: Try To Wrt A Bit More Clrly Using Line And Breaks Proper Upper/LowerCase... And Do Not abbrv Wrds... 4 Ppl Who Do No Speak English As A Native Lng This IM Talk Is Hardly Understable... Writing With Correct Capitalization Is Smpl A Matter Of Courtesy... ::: Esp Bicos.. U R Asking Volunteers For Free Hlp... The abv Parars.. In UR Way Of Wrtng... Wud Luk Like This
Now judge for yourself which of the two versions is easier to read and understand.
It took me a substantial amount of time to understand your "gibberish".
Now to your question:
As far as I can read from your scrambled text, putting a unique index on the column ID should solve your problem.