Viewing 15 posts - 1,186 through 1,200 (of 1,491 total)
Without DDL it is difficult to tell. Maybe something like:
UPDATE S
SET qty_in_stock = qty_in_stock - D.orders
FROM sku S
JOIN (
SELECT S1.sku, S1.labsupplied ,COUNT(*) AS orders
FROM orders O1
JOIN sku S1
ON O1.framestylecode =...
May 30, 2007 at 7:12 am
This sounds like parameter sniffing. The first time the stored procedure is compiled it uses the parameters which were passed to it to generate the most efficient query plan for those...
May 23, 2007 at 3:28 am
I was thinking of a left semi join operator which should require less reads than a join; especially if there are a lot of FKs in TableB for each PK in...
May 22, 2007 at 6:43 am
My experience in SQL2000 is that joins in subqueries always produce nested loops. I therefore suspect that Sergiy's LEFT JOIN solution, or something like the following, will be more efficient.
SELECT...
May 22, 2007 at 5:11 am
In the absence of more information, here is an outline of something that may work.
If it does work, getting rid of the functions should speed it up.
CREATE TABLE #Value
(
Value int...
May 18, 2007 at 10:44 am
Is Value, Perf_YTD unique?
What is the PRIMARY KEY of the table?
May 18, 2007 at 10:03 am
My example was poor.
The potential problem is when the derived table references the table to be updated. If this is the case then an UPDLOCK needs to be applied in...
May 11, 2007 at 10:09 am
Using NOLOCK on an UPDATE statement does not make sense as an XLOCK will be obtained on the table to be updated. To avoid deadlocks UPLOCKs should be applied to all...
May 11, 2007 at 9:32 am
What does the full UPDATE statement look like?
Does it contain a derived table?
May 11, 2007 at 9:01 am
Your Enterprise Manager Designer fiddle obviously does not cope with derived tables. If you want to do this you will have to do the derived tables separately.
I am not convinced...
May 9, 2007 at 5:43 am
Scott's approach looks as thow it could be more efficient.
May 4, 2007 at 8:35 am
Assuming program_name, Order_number, Revenue_milestone is unique for each table, maybe something like:
SELECT D.program_name, D.Order_number, D.Revenue_milestone
,COALESCE(T1.[Labor Hours], 0) AS [Labor Hours]
,COALESCE(T1.[Labor Amount], 0) AS [Labor Amount]
,COALESCE(T2.Materials, 0) AS Materials
FROM (
SELECT T11.program_name,...
May 4, 2007 at 8:05 am
It is a matter of the order of evaluation and ease of understanding.
Table1 LEFT JOIN Table2 can easily be re-written as Table2 RIGHT JOIN Table1 but when more than two...
May 2, 2007 at 7:06 am
Viewing 15 posts - 1,186 through 1,200 (of 1,491 total)