In this post I have explained the way to use UDF (User Defined Functions) in constraints. For the purpose of discussion I have provided the structure of 2 (self explanatory) tables " MasterTable " and " ChildTable ". Sample data for MasterTable have also been provided below. --Table structure of MasterTable: Create Table MasterTable ( ItemID int Identity Primary Key, ItemName Varchar(50), Status bit ) --Sample data for the table MasterTable: Insert Into MasterTable (ItemName, Status) Values ('Rice',1) Insert Into MasterTable (ItemName, Status) Values ('Wheat',1) Insert Into MasterTable (ItemName, Status) Values ('Corn flakes',0) --Table structure of ChildTable: Create Table ChildTable ( ItemID int Foreign Key References MasterTable(ItemID), Quantity int ) Go /* Let us now create an user defined function to check whether the Item exist and its status is 1. According to this sample Status 1 means the record is enabled if it is 0 it is disabled....