December 29, 2009 at 11:13 am
I have 3 tables Adviser , adviserbranch and customer. adviser has branches under him and customers are associated to the the branches(no direct FK of adviser in customer table) . how can i implement duplicate check at databse layer itself that for an adviser customer should not repeat
December 29, 2009 at 12:51 pm
you can always put a unique index on the fields within the table. What is the Primary Key to the table. You might/should be able to use that
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 29, 2009 at 12:53 pm
ndixit
In order to receive help we need you to help us help you.
Please read the first article in my signature block and post the information accordingly. That is table definitions, sample input and desired output, and how you have attempted to solve the problem.
December 30, 2009 at 8:16 am
I'm going to second what bitbucket has requested. Without full table definitions it is nearly impossible to give accurate advice.
Based on the information you have provided it doesn't sound like there is a way to do it with a unique constraint, you'll either have to do it in a trigger (insert/update) or in the business logic of the insert/update.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply