modify temporal tables

  • Hi,

    I'm starting to use temporal tables on a SQL server 2016.
    When I want to change a temporal table I have to remove all foreign key relation ships change the table recreate the FK relationships and enable temporal feature on the table..

    Have enabled it on a table which has 9 FK relationships defined,
    I have now a SQL scripts to drop all FK's and disable the temporal feature on the tabel, and a SQL script to create all FK's and enable the temporal feature on the table again, both made by hand.

    Is there a better way?
    Is there somewhere a script to generate these scripts?

    Thanks in advance,
    Rob

  • I finaly found the problem, you don't need to drop the FK's or the triggers.
    There were views defined with "WITH SCHEMABINDING" that referenced the table.

    To find the views with schema binding use:
    select object_name(m.object_id), m.*
    from sys.sql_modules m
    where m.definition like N'%WITH SCHEMABINDING%'
    order by object_name(m.object_id)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply