Viewing 15 posts - 4,981 through 4,995 (of 10,143 total)
;WITH Employees AS (
SELECT TOP 1
employeeid,
FIRSTNAME,
LASTNAME,
EMAILADDRESS,
STARTDATE
FROM linkedServer.linkedDB.dbo.AUEMPLOYEE
WHERE employee.ENDDATE IS NULL -- still active
ORDER BY ACTIONDATE DESC -- most recent
)
SELECT
e.*,
org.ORGANIZATIONID,
job.JOBTITLEID
FROM Employees e
LEFT...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 26, 2013 at 2:42 am
astrid 69000 (3/26/2013)
Jayanth, I...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 26, 2013 at 2:22 am
matak (3/26/2013)
Expected output where @startNum < @oldnum (startnum 2 oldnum 4)changedinitial
11
32
43
24
55
66
77
88
3 rows affected
Expected output where @startNum > @oldnum (startnum 4 oldnum 2)
changedinitial
11
42
33
24
55
66
77
88
Two rows affected
Are these both correct? The second sample...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 26, 2013 at 2:18 am
Does this help?
;WITH MyData ([day], [Count]) AS (
SELECT '2008-01-01 00:00:00.000', 3 UNION ALL
SELECT '2008-01-01 11:00:00.000', 9 UNION ALL
SELECT '2008-01-01 22:00:00.000', 3 UNION ALL
SELECT '2008-01-02 09:00:00.000',...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 26, 2013 at 2:04 am
Chandan, you're very welcome, thank you for your generous feedback.
This exercise, resolving a simple query from a more complex query referencing many more objects, often isn't successful because of cardinality...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 7:31 am
bugg (3/25/2013)
ChrisM@Work (3/25/2013)
Right-click on the execution plan tab, select...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 6:20 am
OK got it. You need to change two indexes.
1. Include orderhash and status in index IX_SessionID, like this:
CREATE NONCLUSTERED INDEX [IX_sessionid] ON [dbo].[orderha]
([sessionid] ASC, OrderHash ASC) INCLUDE (Status)
2....
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 5:52 am
This article linked in my sig explains in detail how to post execution plans. They're active - .png graphics are not.
Right-click on the execution plan tab, select "Save Execution...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 4:51 am
bugg (3/25/2013)
ChrisM@Work (3/25/2013)
bugg (3/25/2013)
Node:1
KEY: 9:72057602492792832 (860067b2b9d1) CleanCnt:2 Mode:X Flags: 0x1
Grant List 2:
Owner:0x0000000198215A40 Mode: X Flg:0x40...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 4:30 am
bugg (3/25/2013)
Node:1
KEY: 9:72057602492792832 (860067b2b9d1) CleanCnt:2 Mode:X Flags: 0x1
Grant List 2:
Owner:0x0000000198215A40 Mode: X Flg:0x40 Ref:1 Life:02000000...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 3:42 am
Si Thu (3/24/2013)
I have one huge table which has 1Billion records. I tried to delete unnecessary records but it took a lot of time to delete and the delete was...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 25, 2013 at 2:19 am
Lynn Pettis (3/22/2013)
Megha P (3/22/2013)
you can also try below
;WITH CTE AS
(
SELECT docid,pages FROM #x
UNION ALL
SELECT C.docid,C.pages-1
FROM #x X INNER JOIN CTE C
ON X.docid =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 22, 2013 at 10:11 am
It's difficult to tell with all of those funky joins and no sample data, but you might get a win with this too;
SELECT CAST(ID AS NUMERIC(9))
INTO #Accounts
FROM dbo.SplitIDs(@vcAccountId, ',')
SELECT ...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 22, 2013 at 8:33 am
Most folks put in this situation will look for a quick win to buy the time necessary for the complete overhaul which Grant correctly recommends.
I think you have some...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 22, 2013 at 7:57 am
The single biggest cost is a function which references a view which references a function which unnecessarily uses a slow cursor to concatenate some columns. Or something similar. A half...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 22, 2013 at 6:44 am
Viewing 15 posts - 4,981 through 4,995 (of 10,143 total)