# Procedure: sp_helpdiagrams

## Properties

Property | Value
--- | ---
Name | sp_helpdiagrams
ID | 1607676775
Schema | dbo
Owner | dbo
Type | SQL STORED PROCEDURE
Execute As | dbo
Encrypted |
ANSI NULLS |
Uses Quoted Identifier |
Published |
Schema Published |
Execution Replicated |
Replication Serializable Only |
Skips Replication Constraints |
Is Recompiled |
Uses Database Collation |
Null on Null Input |
MS Shipped |
Modify Date | 6/20/2011 3:16:00 PM
Create Date | 6/20/2011 3:16:00 PM

## Extended Properties

No extended properties defined.

## Permissions

#### Permissions for: guest

Permission | Grantor | Grant | With Grant Option | Deny
--- | --- | --- | --- | ---
Alter |  |  |  |
Control |  |  |  |
Execute | dbo |  |  |
Take Ownership |  |  |  |
View Definition |  |  |  |

#### Permissions for: public

Permission | Grantor | Grant | With Grant Option | Deny
--- | --- | --- | --- | ---
Alter |  |  |  |
Control |  |  |  |
Execute | dbo |  |  |
Take Ownership |  |  |  |
View Definition |  |  |  |

## Parameters

Parameter Name | Datatype | Output | Cursor Ref | Readonly | Has Default Value | Default Value | Xml Collection Name | Description
--- | --- | --- | --- | --- | --- | --- | --- | ---
@diagramname | sysname |  |  |  |  |  |  |
@owner_id | int |  |  |  |  |  |  |

## Objects that depend on [sp_helpdiagrams]

- dbo.sp_helpdiagrams

## Objects on which [sp_helpdiagrams] depends

- dbo.sp_helpdiagrams
  - dbo.sysdiagrams

## SQL

Script
SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE PROCEDURE dbo.sp_helpdiagrams ( @diagramname sysname = NULL, @owner_id int = NULL ) WITH EXECUTE AS N'dbo' AS BEGIN DECLARE @user sysname DECLARE @dboLogin bit EXECUTE AS CALLER; SET @user = USER_NAME(); SET @dboLogin = CONVERT(bit,IS_MEMBER('db_owner')); REVERT; SELECT [Database] = DB_NAME(), [Name] = name, [ID] = diagram_id, [Owner] = USER_NAME(principal_id), [OwnerID] = principal_id FROM sysdiagrams WHERE (@dboLogin = 1 OR USER_NAME(principal_id) = @user) AND (@diagramname IS NULL OR name = @diagramname) AND (@owner_id IS NULL OR principal_id = @owner_id) ORDER BY 4, 5, 1 END EXEC sys.sp_addextendedproperty @name=N'microsoft_database_tools_support', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'sp_helpdiagrams'

#### See also

List of Procedures