Advertise with us

How can I create a SQL Server system table

Posted by  Chintoo Semi
 1542  View(s)
Rate this:
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?
  1. Re: How can I create a SQL Server system table

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

           EXEC sys.sp_MS_marksystemobject _MigrationHistory

  1. Re: How can I create a SQL Server system table

    SELECT name = convert(char(30),, rows, dpages,, type
    FROM sysindexes i JOIN sysobjects o ON =
    WHERE < 100 and (indid = 0 or indid =1)

      Modified On Apr-09-2018 01:43:45 AM