Viewing 15 posts - 511 through 525 (of 1,825 total)
This is going to be unanswerable here.
You will have to try both methods on YOUR data , on YOUR system to find the answer.
November 29, 2010 at 5:23 am
I would really like to hear you're logic behind this, it sounds like bad design to me.
November 26, 2010 at 6:22 am
There is no doubt that in *some* circumstances , that 2005 is slower than 2000.
Now that is not to say that the queries in question cannot be rewritten to execute...
November 26, 2010 at 6:19 am
You are using the cte StudHistory multiple times , in this case this is hurting you.
Contrary to popular belief , cte are not spooled or cached in any way shape...
November 26, 2010 at 5:53 am
isNull is similar, but what is your issue with coalesce ?
November 25, 2010 at 6:57 am
Try this...
SELECT empid,contact,'CITY'=
CASE
WHEN contact like '9%' THEN 'Chennai'
WHEN contact like '8%' THEN 'Bangalore'
WHEN contact like '7%' THEN 'Mumbai'
WHEN contact like '6%' THEN 'Pune'
ELSE 'Oversease'
END
FROM emp;
BTW , LEFT is probably...
November 25, 2010 at 4:29 am
grahamc (11/23/2010)
...
Only ever use Dynamic SQL when you absolutely have to because dynamic SQL can't cache any execution plans for re-use later, which is a performance hit (I hope Gail...
November 23, 2010 at 5:52 am
Something like this ?
Be warned though , this is non-sargable ,and will perform badly over a large dataset.
SELECT number,count(*)
FROM custom.Routing
WHERE @var LIKE Number + '%'
group by number
order by count(*) desc
November 23, 2010 at 4:55 am
Unfortunately, for him, he doesent know sargable.
November 23, 2010 at 3:37 am
Obvious Optimization #3
get_interaction_list_employee is using a lot of dynamic with the parameters hard coded , these should be made into parametrized statements to enable plan reuse.
Also subotimal scans of
...
November 23, 2010 at 3:33 am
Obvious optimization #2
ALTER TABLE #1 ADD SamplesIssued nvarchar(600)
UPDATE #1 SET #1.[SamplesIssued] = [dbo].[SamplesByInteraction](interaction_id)
ALTER TABLE #1 ADD Products nvarchar(600)
UPDATE #1
SET #1.Products = dbo.[ProductsByInteraction](interaction_id)
Its bad practice to alter tables , this...
November 23, 2010 at 3:29 am
Obvious Optimization #1
select * into #interactions from @interactions where Year(interaction_date)=left(@period,4) and month(interaction_date)=right(@period,2)
This code should be moved into the preceeding selects and reworded to be
"Where interaction_date >= @firstdayofmonth and interaction_date...
November 23, 2010 at 3:24 am
Hmmm , possibly not the most efficient but does the job i think 😉
with table1 as
(
select dt, cat
...
November 23, 2010 at 2:40 am
Well , that was easy
http://www.sqlservercentral.com/Forums/Topic1024259-338-1.aspx
November 22, 2010 at 6:31 am
Viewing 15 posts - 511 through 525 (of 1,825 total)