select max(isnull(id,0))+1 from table
select coalesce( (select max(id) from YourTable), 0)
max(no records)
isnull(max(id),0)+1
select isnull(max(id),0)+1 from table
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)