Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a SQL Server system table

I am developing a site that uses Entity Framework code first with migrations. After each major release, I take a copy of the production data and set it up in my development environment. I've found that in order to use a production data copy with migrations, it is necessary to copy the __MigrationHistory table from the old development database image to the production database copy.

This works fine, except for one annoying detail: the _MigrationHistory table comes across as a user table instead of a system table. This is not a serious problem as long as I remember to filter it out of my database diffs. But I would prefer to have the new __MigrationHistory table be a system table, just as it is in a database that was created by EF migrations.

Is there a way I can create or copy a SQL Server table so that it appears to be a system table?

like image 748
Paul Keister Avatar asked Aug 09 '13 00:08

Paul Keister


1 Answers

Use the following command change your table to system object. So it will then appear in System Objects.

EXEC sys.sp_MS_marksystemobject _MigrationHistory
like image 124
Dilhan RK Avatar answered Nov 03 '22 05:11

Dilhan RK