| Property | Value |
|---|---|
| Name | sp_creatediagram |
| ID | 1639676889 |
| 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 |
| Permission | Grantor | Grant | With Grant Option | Deny |
|---|---|---|---|---|
| Alter | ||||
| Control | ||||
| Execute | dbo |
|
||
| Take Ownership | ||||
| View Definition |
| Permission | Grantor | Grant | With Grant Option | Deny |
|---|---|---|---|---|
| Alter | ||||
| Control | ||||
| Execute | dbo |
|
||
| Take Ownership | ||||
| View Definition |
| Parameter Name | Datatype | Output | Cursor Ref | Readonly | Has Default Value | Default Value | Xml Collection Name | Description |
|---|---|---|---|---|---|---|---|---|
| @diagramname | sysname |
|
|
|
|
|||
| @owner_id | int |
|
|
|
|
|||
| @version | int |
|
|
|
|
|||
| @definition | varbinary(max) |
|
|
|
|
| Script |
|---|
| SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE PROCEDURE dbo.sp_creatediagram ( @diagramname sysname, @owner_id int = null, @version int, @definition varbinary(max) ) WITH EXECUTE AS 'dbo' AS BEGIN set nocount on declare @theId int declare @retval int declare @IsDbo int declare @userName sysname if(@version is null or @diagramname is null) begin RAISERROR (N'E_INVALIDARG', 16, 1); return -1 end execute as caller; select @theId = DATABASE_PRINCIPAL_ID(); select @IsDbo = IS_MEMBER(N'db_owner'); revert; if @owner_id is null begin select @owner_id = @theId; end else begin if @theId <> @owner_id begin if @IsDbo = 0 begin RAISERROR (N'E_INVALIDARG', 16, 1); return -1 end select @theId = @owner_id end end -- next 2 line only for test, will be removed after define name unique if EXISTS(select diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @diagramname) begin RAISERROR ('The name is already used.', 16, 1); return -2 end insert into dbo.sysdiagrams(name, principal_id , version, definition) VALUES(@diagramname, @theId, @version, @definition) ; select @retval = @@IDENTITY return @retval 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_creatediagram' |