How to create a system object (Table, Stored Procedure, View…)

It is really easy. You just need to add the object name as a parameter to “SYS.SP_MS_MARKSYSTEMOBJECT”. In the following code we are creating a system table named“TestSysTable”:

 

IF OBJECT_ID(N’TestSysTable’) IS NULL

begin

              CREATE TABLE dbo.TestSysTable

              (

                     C1 int NOT NULL,

                     C2 int NOT NULL,

                     C3 int PRIMARY KEY IDENTITY

                    

              )

EXEC SYS.SP_MS_MARKSYSTEMOBJECT ‘TestSysTable’

End

 

All done!

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.