Skip to main content
added 14 characters in body; edited title
Source Link
marc_s
  • 9k
  • 6
  • 45
  • 52

Does anyone have a Storedstored procedure to truncate temporal table?

Does anyone have or know of stored procprocedure that will do generic temporal table manipulation so that history and main table are both truncated?

You have to alter it to set system_versioning = off, then drop the history table, then truncate your main table, then re-enable versioning on your main table. II was going to build a generic sprocstored procedure to do this for any database/schema/table name passed to it but sure be nice if someone already had one. II never like re-inventing the wheel if I can avoid it.

Does anyone have a Stored procedure to truncate temporal table?

Does anyone have or know of stored proc that will do generic temporal table manipulation so that history and main table are both truncated?

You have to alter it to set system_versioning = off, then drop the history table, then truncate your main table, then re-enable versioning on your main table. I was going to build a generic sproc to do this for any database/schema/table name passed to it but sure be nice if someone already had one. I never like re-inventing the wheel if I can avoid it.

Does anyone have a stored procedure to truncate temporal table?

Does anyone have or know of stored procedure that will do generic temporal table manipulation so that history and main table are both truncated?

You have to alter it to set system_versioning = off, then drop the history table, then truncate your main table, then re-enable versioning on your main table. I was going to build a generic stored procedure to do this for any database/schema/table name passed to it but sure be nice if someone already had one. I never like re-inventing the wheel if I can avoid it.

Source Link
Saxman
  • 311
  • 2
  • 10

Does anyone have a Stored procedure to truncate temporal table?

Does anyone have or know of stored proc that will do generic temporal table manipulation so that history and main table are both truncated?

You have to alter it to set system_versioning = off, then drop the history table, then truncate your main table, then re-enable versioning on your main table. I was going to build a generic sproc to do this for any database/schema/table name passed to it but sure be nice if someone already had one. I never like re-inventing the wheel if I can avoid it.