Home Forums SQL Server 2008 T-SQL (SS2K8) Deprecated]Function call can be extracted from the WHERE clause to avoid unnecessary table scan. RE: Deprecated]Function call can be extracted from the WHERE clause to avoid unnecessary table scan.

  • I removed the function from the WHERE and replaced it with a local variable:

    AND CD_DW_INSERT_DATE > @Date

    I got another problem on a JOIN.

    Found filtering columns wrapped inside User-Defined Function call.

    AND PTD.Ptd_trans_process_date = CypressStaging.dbo.Fncconvertas400date(ExtCov.Last_change_date)

    The function dbo.Fncconvertas400date converts AS400 Date format to SQL Server Date.

    I do not know if and what I could do for this?

    Thanks again.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/