• Thanx |Ten Centuries| This is much helpful

    But I am facing another thing which is a bit complex, I have to run the following procedures in the same I have mentioned above by passing the same variables in the clause as; (@YearMonth, @sDate, @eDate), following are the queries I am trying to pass in these SP:

    Begin

    Execute CountStatusD @YearMonth

    Execute CountStatusU @YearMonth

    Execute CountStatusNull @YearMonth

    Execute DisposedBefore @sDate, @eDate, @YearMonth

    Execute DisposedToday @sDate, @eDate, @YearMonth

    End

    SELECT DISTINCT masterdata.gpo_id AS Code, gpo.name AS [GPO Name], COUNT(masterdata.mno) AS [Total MO]

    FROM masterdata INNER JOIN

    gpo ON masterdata.gpo_id = gpo.gpo_id

    WHERE (masterdata.year_month = @YearMonth)

    GROUP BY masterdata.gpo_id, gpo.name

    ORDER BY masterdata.gpo_id

    SELECT DISTINCT gpo_id AS Code, COUNT(mno) AS Delivered

    FROM masterdata

    WHERE (year_month = @YearMonth) AND (status = 'D') -- Here I will pass Three Status as "U and NULL"

    GROUP BY gpo_id

    ORDER BY gpo_id

    SELECT DISTINCT (masterdata.gpo_id) AS Code, COUNT(mno) AS DisposedBefore -- The Same will run as DisposedToday

    FROM masterdata

    WHERE status IS NOT NULL AND year_month = @YearMonth AND date_reported >= @sDate AND date_reported <= @eDate

    GROUP BY masterdata.gpo_id

    ORDER BY masterdata.gpo_id

    Would there be a scenario to run all these queries as one, because I have to update the same tempDailyUPD Table by running all these SP/Queries, like;

    Update tempDailyUPD

    Set DisposedBefore = @DisposedBefore where Code=@Code

    Please help me ...