Click here to Skip to main content
15,883,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

i have one column called jobcode. this should be unique but based on branchid. i mean if branchid is different in that table it should allow same jobcode to be entered again but it should block for same branchid. if i apply unique key directly it will not allow to enter same number again even if branchid is different.


please suggest me something


thanks in advanced.
Posted

 
Share this answer
 
Hello,

If you are using sql server then just open table design then select Both column press right click and Choose "Set Primary Key".

Then both column will behave as you required.



Ankur
 
Share this answer
 

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