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

Author

Soheil Bakhshi

Microsoft Data Platform

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!


Discover more from BI Insight

Subscribe to get the latest posts sent to your email.

BI Insight podcast

Enjoyed this deep dive? Hear more on Spotify.

New episodes on Power BI, Microsoft Fabric and agentic BI. Follow the show so you never miss one.

About the author

Soheil Bakhshi

Microsoft Data Platform

Leave a Comment

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


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