EA7_spGetNewSurveyResponsesCount

Definition

Copy

                CREATE  PROCEDURE [dbo].[EA7_spGetNewSurveyResponsesCount]
                as
                begin
                    set nocount on
                    declare @delTrans         integer
                    declare @newResponses    integer

                    select @newResponses = count(*
                    from dbo.siteSurveyResponses sr 
                    inner join dbo.sitesurveys ss on ss.id = sr.sitesurveysid
                    where dbo.fnGetEEIDFromLinkedUserID(sr.clientusersid) > 0 
                    and EEProcessed = 0 
                    and exists (select * from dbo.SiteSurveyResults ssr where ssr.SiteSurveyResponsesId = sr.id )

                    select @deltrans = count(*)
                    from dbo.SiteSurveyResponsesDeleteTransactions

                    select (@deltrans + @newResponses)
                end