Hey everyone.This is not really a problem rather an attempt to pick your brains for a better (more efficient?) solution.I have a stored procedure that adds a "reference" to a particular ServiceID in Services table to a record in Acccounts table. These tables are joined on the ServiceID fields by a "hard" relationship -- with "Enforce relationship for INSERTs and UPDATEs" enabled.ServiceID is passed in as an input parameter (@service_id_in) to the stored procedure in question. But I want to first check that the input service id actually exists in the Services table, and only then insert it into Accounts table.Right now, I have a (kind of yucki) solution that I use:DECLARE @x tinyintSELECT @x = COUNT(*) FROM Services WHERE ServiceID = @service_id_inIF @x > 0BEGIN INSERT INTO Accounts (Blah, Blee, Doo, ServiceID) VALUES ('doo', 'daa', 'dee', @service_id_in) PRINT 'added ok'ENDELSE PRINT 'did NOT add!!!'I'm sure there's a more elegant approach to doing this.Thanks for your ideasPS: it's a SQL Server 2000 database.Edited by - alebey on 07/14/2001 17:26:09