January 16, 2014 at 10:17 am
The DATEADD function is Deprecated.
What is the best way to achieve the same results without adversely impacting on performance?
WHERE CD_DW_INSERT_DATE > DATEADD(DAY, -7,@Date);
Thanks.
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/
January 16, 2014 at 10:20 am
dateadd is not deprecated.
Lowell
January 16, 2014 at 10:31 am
Lowell (1/16/2014)
dateadd is not deprecated.
I run it through ubitsoft's T-SQL Analyzer and I get the following:
SA0028 : [Deprecated]Function call can be extracted from the WHERE clause to avoid unnecessary table scan.
I'm not sure why I got that error.
Thanks.
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/
January 16, 2014 at 12:06 pm
Welsh Corgi (1/16/2014)
Lowell (1/16/2014)
dateadd is not deprecated.I run it through ubitsoft's T-SQL Analyzer and I get the following:
SA0028 : [Deprecated]Function call can be extracted from the WHERE clause to avoid unnecessary table scan.
I'm not sure why I got that error.
Thanks.
Must be a bug with ubitsoft's reporting because, I agree, DATEADD is not deprecated.
Removal of functions wrapped around columns in the WHERE clause is, however, a great idea.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 16, 2014 at 12:51 pm
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/
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply