USP_DATAFORMTEMPLATE_VIEW_SPONSORSHIPLOCATIONCLOSEPROCESS

The load procedure used by the view dataform template "Close Sponsorship Location View Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@LOCATION nvarchar(515) INOUT Closed location
@REASON nvarchar(100) INOUT Reason
@PARAMETERSID uniqueidentifier INOUT PARAMETERSID

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_SPONSORSHIPLOCATIONCLOSEPROCESS

(
      @ID uniqueidentifier,
      @DATALOADED bit = 0 output,
      @LOCATION nvarchar(515) = null output,
      @REASON nvarchar(100) = null output
      @PARAMETERSID uniqueidentifier = null output    

)

as
      set nocount on;   
      set @DATALOADED = 0;

      select
      @DATALOADED = 1,
      @LOCATION = case when len(dbo.UFN_SPONSORSHIPLOCATION_GETFULLNAME(SP.ID)) <= 515 then dbo.UFN_SPONSORSHIPLOCATION_GETFULLNAME(SP.ID) else dbo.UFN_SPONSORSHIPLOCATION_GETNAME(SP.ID) + ' - ' + convert(nvarchar(36), @ID) end,
      @REASON = RE.REASON,    
      @PARAMETERSID = SP.ID

from dbo.SPONSORSHIPLOCATIONCLOSEPROCESS SP
inner join dbo.SPONSORSHIPREASON RE on SP.SPONSORSHIPREASONID = RE.ID
where
      SP.ID = @ID;

 return 0;