USP_REPORT_PHONEFINDERBATCHCONTROL

Parameters

Parameter Parameter Type Mode Description
@BATCHID uniqueidentifier IN

Definition

Copy

create procedure dbo.USP_REPORT_PHONEFINDERBATCHCONTROL
(
    @BATCHID uniqueidentifier
)
as
    set nocount on;

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

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

        select 
            ' + @TABLENAME + '.[ID], 
            ' + @TABLENAME + '.[NAME], 
            ' + @TABLENAME + '.[NUMBER] as [PHONE]
        from dbo.' + @TABLENAME;

        exec sp_executesql @SQLTOEXEC;

    return 0;