USP_DATAFORMTEMPLATE_EDITLOAD_MKTMARKETINGPLANMAILINGDETAILS_2

The load procedure used by the edit dataform template "Marketing Plan Marketing Effort Details Edit Form 2"

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.
@CAPTION nvarchar(50) INOUT Caption
@LEVEL int INOUT Level
@MARKETINGPLANID uniqueidentifier INOUT Marketing plan item
@NAME nvarchar(100) INOUT Name
@CODE nvarchar(10) INOUT Code
@GOALS nvarchar(max) INOUT Goals
@PLANITEMCATEGORYCODEID uniqueidentifier INOUT Category
@STARTDATE UDT_FUZZYDATE INOUT Start date
@ENDDATE UDT_FUZZYDATE INOUT End date
@SOURCECODEID uniqueidentifier INOUT Source code
@ITEMLIST xml INOUT Items
@CHANNELCODE tinyint INOUT Channel
@MAILDATE datetime INOUT Mail date
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.

Definition

Copy


CREATE procedure dbo.[USP_DATAFORMTEMPLATE_EDITLOAD_MKTMARKETINGPLANMAILINGDETAILS_2]
(
  @ID uniqueidentifier,
  @DATALOADED bit = 0 output,
  @CAPTION nvarchar(50) = null output,
  @LEVEL integer = null output,
  @MARKETINGPLANID uniqueidentifier = null output,
  @NAME nvarchar(100) = null output,
  @CODE nvarchar(10) = null output,
  @GOALS nvarchar(max) = null output,
  @PLANITEMCATEGORYCODEID uniqueidentifier = null output,
  @STARTDATE dbo.UDT_FUZZYDATE = null output,
  @ENDDATE dbo.UDT_FUZZYDATE = null output,
  @SOURCECODEID uniqueidentifier = null output,
  @ITEMLIST xml = null output,
  @CHANNELCODE tinyint = null output,
  @MAILDATE datetime = null output,
  @TSLONG bigint = 0 output
)
as
  set nocount on;

            set @DATALOADED = 0;
            set @TSLONG = 0;

            select
              @DATALOADED = 1,
              @CAPTION = T.[CAPTION],
              @LEVEL = M.[LEVEL],
              @MARKETINGPLANID = M.[MARKETINGPLANID],
              @NAME = M.[NAME],
              @CODE = M.[CODE],
              @GOALS = M.[GOALS],
              @PLANITEMCATEGORYCODEID = [PLANITEMCATEGORYCODEID],
              @STARTDATE = M.[STARTDATE], 
              @ENDDATE = M.[ENDDATE], 
              @SOURCECODEID = M.[SOURCECODEID],
              @ITEMLIST = dbo.UFN_MKTPLANSOURCECODEPART_GETITEMLIST_TOITEMLISTXML(M.[ID]),
              @CHANNELCODE = 0,
              @MAILDATE = M.[MAILDATE],
              @TSLONG = M.[TSLONG]
            from
              dbo.[MKTMARKETINGPLANITEM] M
            left join
              dbo.[MKTMARKETINGPLANITEMTEMPLATEITEM] T on (M.MARKETINGPLANID=T.MARKETINGPLANID and M.LEVEL=T.LEVEL)
            where
              M.[ID] = @ID;

            return 0;