I have a stored procedure that increments a Job Number for a Service call which works fine, unless this jobnumber is the first. In which case it trys to increment off null.Is there a way, Im assuimg CASE WHEN, to test whether the value is equal to null if so value = 1? (@CallNumber int,@Engineer varchar(50),@Description varchar(200),@Date datetime,@tmpJobNumber int)ASSelect @tmpJobNumber = max(JobNumber) + 1 From TABservjobWHERE CallNumber = @CallNumber/** Case WHEN Statement here to test if @tmpJobNumber is null??**/INSERT INTO TABservjob(CallNumber,JobNumber,Engineer,Description,Date)VALUES(@CallNumber,@tmpJobNumber,@Engineer,@Description,@Date)RETURN
cheers 