Archiving data from Table1 to Table2 upon condition | Sql Server 2017 Express
Archiving data from Table1 to Table2 upon condition | Sql Server 2017 Express I have a database with two tables: Table Student with the following columns: Student StudentID int identity, StudentFN, StudentLN, Active bit, EnrollmentDate Table ArchivedStudent with the following columns: ArchivedStudent ArvchivedStudentID int identity, StudentID int, StudentFN, StudentLN, WithdrawalDate getdate(), ReasonDropped In the long run, I'd like to schedule automatic updates for the table AcrchivedStudent and move the data from columns StudentID, StudentFN and StudentLN from table Student to table ArchnivedStudent when column Active changes from 1 (true) to 0 (false). AcrchivedStudent StudentID, StudentFN StudentLN ArchnivedStudent Here's my start up script that is not working: update [as] set [as].StudentID = s.StudentID, [as].StudentFN = s.StudentFN, [as].StudentLN = s.StudentLN from ArchivedStudent [as] inner join Student s on [as].StudentID = s.StudentID where s.Active = 0 go ...