USP_IDSET_DELETE
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@FUNCTIONNAME | nvarchar(128) | IN | |
@FUNCTIONNAMEEXISTS | nvarchar(128) | IN | |
@CHANGEAGENTID | uniqueidentifier | IN |
Definition
Copy
create procedure [dbo].[USP_IDSET_DELETE]
@FUNCTIONNAME as nvarchar(128),
@FUNCTIONNAMEEXISTS as nvarchar(128),
@CHANGEAGENTID [uniqueidentifier] = null
with execute as owner
as
declare @OBJID as integer
-- drop existing tv function
select @OBJID = id from dbo.sysobjects where id = object_id(N'[dbo].[' + @FUNCTIONNAME + ']') and type in (N'FN', N'if', N'TF', N'FS', N'FT')
if not @OBJID is null
exec ('DROP FUNCTION [dbo].[' + @FUNCTIONNAME + ']')
-- drop as-of date version
select @OBJID = id from dbo.sysobjects where id = object_id(N'[dbo].[' + @FUNCTIONNAME + '_WITHASOFDATE]') and type in (N'FN', N'if', N'TF', N'FS', N'FT')
if not @OBJID is null
exec ('DROP FUNCTION [dbo].[' + @FUNCTIONNAME + '_WITHASOFDATE]')
-- drop scalar function
set @OBJID = null
select @OBJID = id from dbo.sysobjects where id = object_id(N'[dbo].[' + @FUNCTIONNAMEEXISTS + ']') and type in (N'FN', N'if', N'TF', N'FS', N'FT')
if not @OBJID is null
exec ('DROP FUNCTION [dbo].[' + @FUNCTIONNAMEEXISTS + ']')
return 0