Viewing 15 posts - 1,801 through 1,815 (of 10,143 total)
SELECT t.RBR, t.Value, x.Value
FROM #Test t
OUTER APPLY (SELECT ti.Value FROM #Test ti WHERE ti.RBR = t.RBR AND ti.Attribute = 'CRE') x
WHERE t.Attribute = 'XLOC'
GROUP BY t.RBR, t.Value, x.Value
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
February 1, 2016 at 7:44 am
As Phil has pointed out the performance of this code will be poor. Can you post the code for function dbo.isarbeitstag? Does it reference a calendar table?
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
February 1, 2016 at 7:34 am
SQL006 (1/31/2016)
This is just the scenario i created, In production there is no temporary table #Test only physical table which consists of 2 million data....
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
February 1, 2016 at 1:29 am
Luis Cazares (1/29/2016)
SELECT Id,
Amount,
CashFlowDate
FROM #Test
CROSS APPLY( VALUES(Principal, 'Principal'), (Interest, 'Interest')) x(Amount,AmtType)
WHERE...
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
January 29, 2016 at 9:16 am
Koen Verbeeck (1/29/2016)
Apparently got over 15,000 points today. Yay. :w00t:
What? In one day? Fingers on fire!
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
January 29, 2016 at 9:07 am
You could use row constructors for this too:
SELECT
t.Id,
x.Amount,
t.CashFlowDate
FROM #Test t
CROSS APPLY (
VALUES
(CASE WHEN t.CashFlowDate between '2016-01-01' AND '2016-01-05' THEN t.Principal ELSE NULL END),
(CASE WHEN t.CashFlowDate between...
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
January 29, 2016 at 5:55 am
SELECT
t.Id,
x.Amount,
t.CashFlowDate
FROM #Test t
CROSS APPLY (
SELECT [Amount] = CASE
WHEN t.CashFlowDate between '2016-01-01' AND '2016-01-05' THEN t.Principal ELSE NULL END
UNION ALL
SELECT [Amount] = CASE
WHEN...
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
January 29, 2016 at 5:43 am
Ed Wagner (1/27/2016)
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
January 28, 2016 at 1:51 am
Grant Fritchey (1/27/2016)
ChrisM@Work (1/27/2016)
Grant Fritchey (1/27/2016)
ChrisM@Work (1/27/2016)[hrMy jaw hit the floor when I read the last paragraph. No support for cross-database queries? Two databases on the same "instance" isn't allowed...
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
January 27, 2016 at 7:34 am
Grant Fritchey (1/27/2016)
ChrisM@Work (1/27/2016)[hrMy jaw hit the floor when I read the last paragraph. No support for cross-database queries? Two databases on the same "instance" isn't allowed or the two...
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
January 27, 2016 at 5:34 am
GilaMonster (1/27/2016)
ChrisM@Work (1/27/2016)
Two databases on the same "instance" isn't allowed or the two databases can't reference each other using three-part naming?
With Azure SQL DB, there's no such thing 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
January 27, 2016 at 3:01 am
Hugo Kornelis (1/26/2016)
Grant Fritchey (1/25/2016)
Hugo Kornelis (1/25/2016)
Grant Fritchey (1/25/2016)
What blockers...
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
January 27, 2016 at 2:02 am
mw112009 (1/25/2016)
Please see attached.
The highlighted field represents my PC name.
All this time I have been connecting to other servers. This time I thought I will have something locally on my...
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
January 26, 2016 at 2:35 am
ben.brugman (1/25/2016)
Luis Cazares (1/25/2016)
Another option:
SELECT UPPER( REPLACE( CONVERT(char(11), GETDATE(), 106), ' ', '-'))
Be carefull with dates, very often the language or the regional settings are important.
For the solution of Luis...
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
January 25, 2016 at 9:17 am
Luis Cazares (1/25/2016)
Of course, there's a syntax error as you're following the FORMAT syntax instead of the CAST syntax.
Worth a try:
Dim SQLStringtempprd123 As String = "SELECT CAST([create_dtim] AS DATE), COUNT(*)...
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
January 25, 2016 at 8:15 am
Viewing 15 posts - 1,801 through 1,815 (of 10,143 total)