I have two tables, one with columns accountid, category, code, name, desc and the other with columns id, accountid, code, reason, desc, active.
Is there any way I can create a constraint such that code in the second table contains only values of code that are in first table with condition where category is somevalue?
sql-serverto the list of other blue-boxes at the bottom of your question. Like what I've just done for you ;)