USP_DATAFORMINSTANCE_DELETESUPPORTINGPROCEDURES

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy



create procedure [dbo].[USP_DATAFORMINSTANCE_DELETESUPPORTINGPROCEDURES]
    @ID [uniqueidentifier]
with execute as owner
as

set nocount on

declare @DBObjectName as nvarchar(128)
declare @OBJID as integer
declare @FormattedID nvarchar(36)

set @FormattedID = replace(cast(@ID as nvarchar(36)), '-', '_')

-- drop existing add NEW sp
set @DBObjectName = 'USP_DATAFORM_ADDNEW_' + @FormattedID

select @OBJID = id from sysobjects where id = object_id(N'[dbo].[' + @DBObjectName + ']') and type = 'P'
if not @OBJID is null
    exec ('DROP PROCEDURE [dbo].[' + @DBObjectName + ']')

-- drop existing LOAD sp
set @DBObjectName = 'USP_DATAFORM_LOAD_' + @FormattedID

set @OBJID = null
select @OBJID = id from sysobjects where id = object_id(N'[dbo].[' + @DBObjectName + ']') and type = 'P'
if not @OBJID is null
    exec ('DROP PROCEDURE [dbo].[' + @DBObjectName + ']')

-- drop existing EDIT view
set @DBObjectName = 'V_DATAFORM_EDIT_' + @FormattedID

set @OBJID = null
select @OBJID = id from sysobjects where id = object_id(N'[dbo].[' + @DBObjectName + ']') and type = 'V'
if not @OBJID is null
    exec ('DROP VIEW [dbo].[' + @DBObjectName + ']')

return 0