@Gila-Monster
Hi,
I would like to give you a small correction in your code which is the right one, it is a small thing but needed.
in your query you have given the end-date-range as the start-date-range (in between clause in the where clause ), i am just correcting it.
--1st query correction
select last_execution_time, dbid, objectid, text
from sys.dm_exec_query_stats qs
cross apply sys.dm_exec_sql_text(qs.sql_handle)
where statement_start_offset = 0
and objectid is not null
---- Correction is in this line.
and last_execution_time between DATEADD(dd,-1,getdate()) and getdate()
--same correction in the second query too