Skip to content

Commit f35802a

Browse files
committed
update
1 parent 47b2005 commit f35802a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

script-generation/GetGRANT.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ BEGIN
2626
FROM sys.all_objects AS sp
2727
WHERE (sp.type = 'P' OR sp.type = 'RF' OR sp.type='PC')
2828
AND SCHEMA_NAME(sp.schema_id) = @Schema
29-
AND sp.name NOT IN ('GetGRANT')
3029
AND PATINDEX('%EXECUTE%',@Grants) > 0
3130
AND PATINDEX(@ObjectPattern,sp.name) > 0
31+
--exclude itself
32+
AND FORMATMESSAGE('[%s].[%s]',OBJECT_SCHEMA_NAME(@@PROCID),OBJECT_NAME(@@PROCID)) <> FORMATMESSAGE('[%s].[%s]',SCHEMA_NAME(sp.schema_id),OBJECT_NAME(sp.object_id))
3233
UNION ALL
3334

3435
--Function

0 commit comments

Comments
 (0)