   SELECT ROW_NUMBER() OVER(ORDER BY A.LogDate DESC) AS RowNum,
          A.Id Id,
          COALESCE(CONVERT(CHAR(19), A.LogDate, 120), '-') AS LogDate,
          A.ApiId AS ApiId,
          B.ApiName AS ApiName,
          B.ApiDesc AS ApiDesc,
          A.FileId AS FileId,
          A.FileOwner AS FileOwner,
          A.FileName AS FileName,
          A.FileLabelGuid AS FileLabelGuid,
          C.LabelDesc AS LabelDesc,
          A.FileSize AS FileSize,
          A.NewFileName AS NewFileName,
          A.NewFileOwner AS NewFileOwner,
          A.NewFileLabelGuid AS NewFileLabelGuid,
          D.LabelDesc AS NewLabelDesc,
          A.NewFileSize AS NewFileSize,
          A.JobOwner AS JobOwner,
          A.JobResult AS JobResult,
          A.JobTime AS JobTime,
          A.JobMessage AS JobMessage,
          A.ServerIpAddr AS ServerIpAddr,
          A.ApiGuid AS ApiGuid,
          A.ApiKey AS ApiKey
     FROM TB_AIP_FILE_JOB_LOG A
LEFT JOIN TB_AIP_API_INFO B
       ON A.ApiId = B.ApiId
LEFT JOIN TB_AIP_LABEL C
       ON A.FileLabelGuid = C.LabelGuid
LEFT JOIN TB_AIP_LABEL D
       ON A.NewFileLabelGuid = D.LabelGuid
    WHERE A.LogDate BETWEEN CONVERT(DATETIME, @startDate, 20) AND CONVERT(DATETIME, @endDate, 20)
