I am trying to write a SP for SQL7 that is freaking on me. Everything below works GREAT unless the database is totally empty with no records in there. Well if there are no records in the db yet, the max(IDField) isn't working properly. If there is no records in the DB yet, I need to have @Max_ID set to '0'. Declare @Max_ID Integer Select @Max_ID = max(IDField) + 1 From tablename Ideas? Todd DeFrane CFBoards.com ------------------------------------------------------------------------------ Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

