select max(#attributes.PrimaryKEY#) as Max_ID from #attributes.tablename#