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