I have an 800+ line SELECT that I am tuning before using it as the source in an SSIS package. I have reduced the original time it took from around 19 minutes down to just under 2 minutes and now I'm running out of ideas.
My last gain was a 30 second reduction by removing all UDF calls.
There are a large number of CAST statements as my source data needs to be converted for the target table (such as casting decimal as money, varchar as nvarchar, etc.).
Is this likely to have any significant impact on the performance of my statement or not enough to bother about? Maybe using the SSIS convert option would be more efficient?
In some places I have CAST(0 as money). Would it be quicker to define a variable as money with value zero and assign that?
Nick Ryan SQL Server Developer OnePath (NZ) Ltd