I'm trying to drop a column from a temporal table but still keep the data in the history.
Simply using alter drop will delete the column from the history table as well so it won't do.
I've tried to set the system_versioning = off, drop it and then return it to be on but its creating a new history table and all the previes history is gone (I can't define the old history table to be the current because it contained another column - the one that I dropped). Is there a way to do it?
As I mentioned in the comments the two tables (the "live" and history table) must have the same definitions. If you
DROPa column from the "live" table it isDROPed from the history table.As such, if you want to retain that data don't
DROPit. InsteadUPDATEall the values toNULL, which might need anALTERon the column to make itNULLable (and you may need to drop someCONSTRAINTs). Then you just omit the column in your workflows going forwards, unless you need it when querying the history table: