This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In the previous post, I shared basic about SQL Server 2016 System-versioned temporal tables and how you can create it.
In the previous post, I created a tbl_Studetns table and now for testing, I am going to drop it here.
1 2 |
DROP TABLE tbl_Students GO |
But unfortunately, I got the below error.
1 2 |
Msg 13552, Level 16, State 1, Line 1 Drop table operation failed on table 'RND.dbo.tbl_Students' because it is not supported operation on system-versioned temporal tables. |
The reason is, it is a system-versioned table and its dependent object is tbl_StudentsHistory table.
The solution is to disable system-versioned on that table by executing following statement.
1 |
ALTER TABLE dbo.tbl_Students SET (SYSTEM_VERSIONING = OFF) |
Now, you can drop the tbl_Students table.
Please note:
We disabled the System-versioned so it will not drop a tbl_StudentsHistory table. If you want to tbl_StudentsHistory, you can use drop command to drop it.
1 2 |
DROP TABLE tbl_StudentsHistory GO |
Leave a Reply