USP_SOURCEANALYSISRULE_VALIDATESMARTFIELDDELETE

Validates that the smart field is not in use by a source analysis rule.

Parameters

Parameter Parameter Type Mode Description
@SMARTFIELDID uniqueidentifier IN

Definition

Copy


CREATE procedure dbo.USP_SOURCEANALYSISRULE_VALIDATESMARTFIELDDELETE
(
  @SMARTFIELDID uniqueidentifier
)
with execute as caller
as
  set nocount on;

  if @SMARTFIELDID is not null begin
    if exists (select 1
               from dbo.[MKTSOURCEANALYSISRULEFIELDS]
               where [MKTSOURCEANALYSISRULEFIELDS].[SMARTFIELDID] = @SMARTFIELDID
      begin
        raiserror('The smart field cannot be deleted because it is being used by a source analysis rule.',13,1);
      end
  end

  return 0;