Plan analyzer

Ash22 2016-07-09 20:55:25

I got the following maintenance plan and noticed that plan is complaining that it is doing a complex clustered index scan. In this scenario, it is trying to execute a function to find min EPOCH time. Is there a recommended way to compare dates in SQL server to avoid this clustered scan?

Aaron Bertrand 2016-07-13 02:43:28
I don't think the clustered index scan is occurring because of the use of the function, but can you show one of the actual queries or attach/e-mail a .sql file that contains the entire batch of T-SQL? (The larger queries are truncated in the XML by SQL Server, so it is impossible to see exactly how StartEpoch/EndEpoch are used.) Also, can you show the definition of the fnDateTime2EpochMSC function?