Tag Info

Hot answers tagged

3

It's quite difficult to give any suggestions based on that information, but here's the approach I normally use for performance tuning. The order of different steps can vary, but these usually give quite a good idea where the improvements should be done. 1) Check for blocking if someone else is blocking the query, you should focus on the blocking query ...


2

You might speed up the SP by applying index and converting multiple select statements to single as all written for same purpose but as per your below statement you need to do more. 'It is not just this set of queries. I have multiple select and insert statements in my stored procedure; my goal is to take data from different tables to update a row in ...


1

As Mark mentioned, UNPIVOT would be a good choice here. I often find it's easier to throw the original query into a temp table then unpivot that. You could use that approach, CTEs or views depending on performance. All the datatypes need to line up for it to work, so I'm casting everything to MONEY in my example, something like this: IF ...



Only top voted, non community-wiki answers of a minimum length are eligible