Viewing 15 posts - 2,236 through 2,250 (of 10,143 total)
-- expand this repeating sequence to cover the maximum number of sales by customer
SELECT
CustomerID,
SaleDate1 = MAX(CASE WHEN rn = 1 THEN SaleDate ELSE NULL END),
Location1 = MAX(CASE WHEN rn...
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
August 20, 2015 at 2:23 am
serviceaellis (8/19/2015)
DECLARE @yr AS int;
SET @yr = 2015;
which is used in
WHERE (YEAR(EndDate) = @yr)
...
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
August 20, 2015 at 2:11 am
dudekula.kareemulla (8/19/2015)
I got your point but here situation may be swipe-in and swipe-out machines are separate and
new joiners may be confused and done instead of...
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
August 20, 2015 at 2:00 am
Jeff Moden (8/20/2015)
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
August 20, 2015 at 1:57 am
coolchaitu (8/20/2015)
There is remote join in the query you posted. I came across an article that says Remote join doesn’t work well on SQL server 2005. Ours is...
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
August 20, 2015 at 1:46 am
In case this spills past UK time, this is what I have so far:
DECLARE @lobid INT = 3,@LineOfBusiness VARCHAR(50)='ECN'
DECLARE @CmsContractID VARCHAR(MAX)='H9285'
SELECT DISTINCT D.DeterminantID AS BEN_CAT_ID
,DENSE_RANK() OVER...
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
August 19, 2015 at 9:02 am
Eric M Russell (8/19/2015)
squvi.87 (8/19/2015)
...
Yes it produces correct result only, it took 30 mins. If I remove the [SplitString] part from the query it took only 5-10 seconds.
OUTER APPLY (
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
August 19, 2015 at 8:59 am
serviceaellis (8/19/2015)
ChrisM@Works,The columns except the last four columns which are:
MembershipTypeIdEndDateInvoiceNumberPersonMembership_PersonId
Thanks. What about the content? What do the results tell you?
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
August 19, 2015 at 8:38 am
Luis Cazares (8/19/2015)
Have you considered changing your splitter function to a faster one?Here's probably the fastest available: http://www.sqlservercentral.com/articles/Tally+Table/72993/
Thanks for your help Luis - there's plenty to go round in this...
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
August 19, 2015 at 8:13 am
Here's the first part. Run it, report back with your findings. Are there loads of dupes in the output?
IF OBJECT_ID('tempdb..#DeterminantAttributeValue') IS NOT NULL DROP TABLE #DeterminantAttributeValue
SELECT
DAV.DeterminantAttributeID, DAV.TypeID,
Value1Part =...
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
August 19, 2015 at 7:35 am
squvi.87 (8/19/2015)
ChrisM@Work (8/19/2015)
1. Spilling sorts occur when the number of rows received by the sort operator is more than the estimate. If you examine the property sheet of the...
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
August 19, 2015 at 7:24 am
Fantastic, thanks.
1. Spilling sorts occur when the number of rows received by the sort operator is more than the estimate. If you examine the property sheet of the sort operator,...
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
August 19, 2015 at 7:11 am
Can you post the entire query please, and the definition of the tvf "splitstring".
Cheers.
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
August 19, 2015 at 6:17 am
;WITH ProcessedData AS (
SELECT EmpName, SwipeDate, MIN_SwipeTime = MIN(SwipeTime), MAX_SwipeTime = MAX(SwipeTime), SwipeType, grp
FROM (
SELECT EmpName, SwipeDate, SwipeTime, SwipeType, grp = rn1-rn2
FROM (
SELECT
EmpName, SwipeDate, SwipeTime, SwipeType,
rn1 = ROW_NUMBER()...
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
August 19, 2015 at 3:14 am
dineshhp (8/19/2015)
I have a table Test123 having three column EmpID,AttribName,AttribValue.
Please run the below query to generate table structure and data.
Create Table Test123(EmpID int,AttribName varchar(50),AttribValue varchar(50))
insert into Test123 values(1,'Name','X')
insert...
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
August 19, 2015 at 1:53 am
Viewing 15 posts - 2,236 through 2,250 (of 10,143 total)