File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- This outlines how to set the "is_ms_shipped" flag to one for custom stored procedures in SQL Server.
2+ -- Note: The following has to be executed as a sysadmin
3+
4+ -- Create stored procedure
5+ CREATE PROCEDURE sp_example
6+ AS
7+ BEGIN
8+ SELECT @@Version
9+ END
10+
11+ -- Check properties of proc
12+ SELECT name,is_ms_shipped FROM sys .procedures WHERE name = ' sp_example'
13+
14+ -- Flag the procedure as a system object via a DAC connection via
15+ -- Reference for incline DAC connection: https://github.com/NetSPI/PowerUpSQL/blob/master/templates/tsql/Get-DACQuery.sql
16+
17+ -- Note: This changes the proc to a system object, but doesn't change from the dbo to sys schema.
18+ -- Source: https://raresql.com/tag/sp_ms_marksystemobject/
19+
20+ exec sys .sp_ms_marksystemobject sp_example
21+
22+ -- Check properties of proc
23+ SELECT name,is_ms_shipped FROM sys .procedures WHERE name = ' sp_example'
24+
25+ -- Note: To remove the flag the procedures need to be dropped and recreated.
You can’t perform that action at this time.
0 commit comments