Administrator
  •  Admin
  • Advanced Member Topic Starter
2004-05-12T23:23:00Z
if no records exists max + 1 will return NULL
Example:
Select (max(MyID)+1) from MyTable

To avoid this problem use:
Select ISNULL((max(MyID)+1),1) from MyTable
Administrator
  •  Admin
  • Advanced Member Topic Starter