Search the Community
Showing results for tags 'update table'.
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?
I currently have a tbl_membership table, with data currently in it over 2,000 records. I added a new column in my table and now I need to populate it with all the same content "2016 DB Update". How can I do this so that all my 2,000 plus records are update with this new column?