I'm working on a crud for an email application, and I'd like the ability to change "everything". Right now, however, it matches the JSON string to the Database based on the email address.
Problem: Under this model, a user can never change their email. A new email address = a new user.
declare @email varchar(255), @ID int insert into announcement_jsonlog (json_string) values (@json) select @email = email from openjson(@json) WITH (email varchar(255) '$.Email') insert into announcement_contacthistory ( ID, Email, Prefix, FirstName, MiddleInitial, LastName, Suffix, Title, Company, Address1, Address2, City, State, Zip, Zip_4, Phone, Extension, Unregistered, AddDateTime, LModifiedDateTime, longkey, shortkey, History_addDateTime) select *, current_timestamp from announcement_contact where email = @email
Question: how would you design a CRUD that lets you change the email address, too?