I know it sounds a bit odd but DELETE statements really do ignore table constraints. Running the code below in a test database will setup a test to prove this. CREATE TABLE ProductConstraintTest ( ProductID INT IDENTITY(1,1), ProductCode VARCHAR(50), ProductName VARCHAR(100), Cost DECIMAL(19,4), Price DECIMAL(19,4) ); GO CREATE FUNCTION chkProductCount() RETURNS INT AS BEGIN DECLARE […]
Hi, I'm James Anderson. When I'm not blogging about SQL Server, I do this.