• As for the date comparision, I'd rewrite the query as follows to allow for the use of an index on creation_time if it exists:

    select

    *

    from

    inow6.dbo.in_wf_item_arch

    where

    queue_id in ( SELECT

    [object_id]

    from

    report_objects

    where

    report_id = @report_id

    and [type] = 'Queue')

    --and DATEADD(dd, DATEDIFF(dd,0,creation_time), 0) = DATEADD(dd, DATEDIFF(dd,0,@actiondate), 0)

    and creation_time >= DATEADD(dd, DATEDIFF(dd,0,@actiondate), 0) --creation_time equal or greater than midnight of @actiondate

    and creation_time < DATEADD(dd, DATEDIFF(dd,0,@actiondate) + 1, 0) -- and less than midnight @actiondate + 1 day