Skip to content

Commit 723a9bb

Browse files
authored
Create Set-XpMsShipped.sql
1 parent 9ca9d4c commit 723a9bb

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

templates/tsql/Set-XpMsShipped.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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.

0 commit comments

Comments
 (0)