Viewing 15 posts - 7,486 through 7,500 (of 10,143 total)
Looks to me like all the crazy looping is date arithmetic. Try this as a replacement for the entire stored procedure - don't forget to put appropriate values into 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 20, 2010 at 7:48 am
drew.allen (8/19/2010)
Chris Morris-439714 (8/18/2010)
WHERE PartitionSize IN (1, Seq*2, Seq*2-1) -- < changed 3rd param hereCheers
ChrisM
This makes it seem like 1 is a special case when it's actually an exemplar...
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, 2010 at 3:13 am
Sure. If you remove the filter and instead mark the selected rows in the SELECT, you can see exactly what's happening...
DROP TABLE #VW_AE_SUS
CREATE TABLE #VW_AE_SUS (
PurchCode VARCHAR(5),
Provcode VARCHAR(5),...
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, 2010 at 5:58 am
Steve Jones - Editor (8/18/2010)
I shall decline to post my word for the day:w00t:
Similar to French Connection UK?
Sorry to hear about PASS, Steve.
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, 2010 at 2:24 am
Hi Richard
Try changing the innermost select
SELECT PurchCode = LEFT(PurchCode, 3),
...
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 18, 2010 at 10:23 am
Hi Richard
Your sample output values don't appear to exist in the sample data, however something like this should do the trick:
SELECT PurchCode, Provcode, Duration, Seq, PartitionSize
FROM ( -- final
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 18, 2010 at 8:27 am
You're welcome.
Jack's post and invaluable explanation has already found a use here 😎
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 18, 2010 at 7:06 am
Run this, look at the columnname in the top resultset 🙂
DECLARE @command VARCHAR(MAX)
SET @command = 'SELECT GETDATE()' + CHAR(10) + 'go' + char(10) + 'SELECT GETDATE()'
PRINT @command
exec (@command)
Use ; as...
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 18, 2010 at 5:47 am
Here's the link to Jack's post:
http://www.sqlservercentral.com/Forums/FindPost964392.aspx
The post points out that it's the order of the ON clauses which changes the effect of the query, rather than the order in which...
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 18, 2010 at 2:16 am
Jack Corbett posted up a blog link recently which covered this, and the fact that the join sequence and the position of the ON clauses can have a profound effect...
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 17, 2010 at 10:23 am
mbricker-600840 (8/17/2010)
sing4you (8/17/2010)
Chris Morris-439714 (8/17/2010)
Ticky tack"Little houses on the hillside..."
"And they all look just the same"
There really is a song?
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 17, 2010 at 9:50 am
Richard
You're welcome, come back if you have any questions.
Cheers
ChrisM
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 17, 2010 at 9:41 am
Jeff Moden (8/17/2010)
Oh, I see it coming...
Heh Jeff got that porkchop launcher loaded up for the first triangular join post? 😀
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 17, 2010 at 9:16 am
Ticky tack
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 17, 2010 at 8:31 am
-- sample data
DROP TABLE #Sample
CREATE TABLE #Sample (PurchCode VARCHAR(3), Provcode VARCHAR(5), ArrivalDate DATE, ArrivalTime VARCHAR(5), DepartureTime VARCHAR(8))
INSERT INTO #Sample
(PurchCode, Provcode, ArrivalDate, ArrivalTime, DepartureTime)
SELECT '5A3', 'RD130', '01/02/2010', '18:13', '20:30:00' UNION ALL
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 17, 2010 at 8:07 am
Viewing 15 posts - 7,486 through 7,500 (of 10,143 total)