ravi.teja 62048 (6/18/2014)
CREATE TRIGGER caseid_increment_trigger BEFORE INSERT ON ecaseFOR EACH ROW SET NEW.case_id = (select ifnull(max(case_id),9999) + 1 from ecase where project_id = new.project_id);
That's not a SQL Server trigger (SQL Server doesn't have FOR EACH ROW triggers, nor does it have BEFORE triggers). Maybe post your question on an MySQL site, rather than one dedicated to MS SQL Server?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability