Search the Community
Showing results for tags 'increasing value'.
I'm trying to create a trigger that will add fields to a bunch of related tables based on the new CCTAproject_id that is entered on the parent table. It won't let me get rid of the ID field for some reason so I'm guessing that is a necessary field. My solution was to take the max existing value in the ID field and add a 1, so that new records increase sequentially by 1. I get an error when using this method, "Column '#inserted.CCTAproject_id' is invalid in the select list because it is not contained in either an aggregate function of the GROUP BY clause, (error code: SQL8120). But if I remove the number block containing the "MAX etc" and just leave it to equal a static number, the trigger works. I don't understand what the error means by grouping since the ID field is an integer and I'm not trying to group different field. Is there a way to manipulate the trigger so the numbers can increased based on existing values?