USP_REPORT_EDUCATIONHISTORYUPDATEBATCHCONTROLREPORT

Returns the data necessary for the educational history update batch control report.

Parameters

Parameter Parameter Type Mode Description
@BATCHID uniqueidentifier IN

Definition

Copy


CREATE procedure dbo.USP_REPORT_EDUCATIONHISTORYUPDATEBATCHCONTROLREPORT(@BATCHID uniqueidentifier)
with execute as owner
as
    set nocount on;

    declare @TABLENAME nvarchar(128);
    select @TABLENAME = dbo.UFN_BATCH_GETREPORTTABLENAME(@BATCHID, 0)

    declare @SQLTOEXEC nvarchar(1000);

    set @SQLTOEXEC = N'set nocount on;
        declare @SEPERATOR nvarchar(2);
        set @SEPERATOR = ''; '';

        select 
            ID, 
            CONSTITUENTNAME, LOOKUPID, INSTITUTION, PROGRAM, DEGREE,
            (case when COLLEGE is not null then COLLEGE else '''' end) 
            + (case when DIVISION is not null then @SEPERATOR + DIVISION else '''' end)
            + (case when DEPARTMENT is not null then @SEPERATOR + DEPARTMENT else '''' end)
            + (case when SUBDEPARTMENT is not null then @SEPERATOR + SUBDEPARTMENT else '''' end) 
            + (case when DEGREETYPE is not null then @SEPERATOR + DEGREETYPE else '''' end) ADDL_INFO
        from dbo.' + @TABLENAME;
    exec sp_executesql @SQLTOEXEC;