Viewing 15 posts - 6,601 through 6,615 (of 10,143 total)
Jeff Moden (10/14/2011)
To add to ChrisM's code, please see the following article on how to display smaller hierarchies likes this...
Teach a guy to fish - I'd like to add that...
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
October 14, 2011 at 9:15 am
Closer, but still no cigar:
SELECT
RTRIM(First_name) + ' ' + RTRIM(Last_Name),
RTRIM(First_name) + CASE WHEN RIGHT(First_name,1) = ' ' THEN ' ' ELSE '' END + RTRIM(Last_Name),
...
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
October 14, 2011 at 8:32 am
Ninja's_RGR'us (10/14/2011)
adlakha.22 (10/14/2011)
Your query worked great when I tried with distinct.But still its taking 83 Seconds to execute.
Do you have any other idea to make it more optimize.
Thanks in advance
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
October 14, 2011 at 8:13 am
;WITH tree AS (
SELECT DISTINCT uid, cat_parent, cat_name, node = 0
FROM #temp where cat_parent = 0
UNION ALL
SELECT t.uid, t.cat_parent, t.cat_name, node = l.node+1
FROM tree L
INNER JOIN #temp t ON l.uid...
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
October 14, 2011 at 7:27 am
20x faster! I'm going home...:blush:
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
October 14, 2011 at 7:11 am
Anytime Phil. Test them both, I reckon Lowell's MegaCASE will win hands down.
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
October 14, 2011 at 7:04 am
Lowell (10/14/2011)
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
October 14, 2011 at 6:50 am
Something similar to this outperforms the obvious pivot approach for removing the blanks from address elements:
select t.*, x.ColIndex
from @Tab1 t
CROSS APPLY (SELECT TOP 1 ColIndex from (
SELECT ColIndex =...
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
October 14, 2011 at 6:34 am
Can you confirm which version of SQL Server you are using? There's no 2003 version.
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
October 13, 2011 at 7:49 am
Junglee_George (10/13/2011)
Chris, whats on your mmind..Which Method is better..first or second..??
Easy - test them 😉
It's an unrestricted update though, one pass is likely to be better than two or more.
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
October 13, 2011 at 6:02 am
No problem. This relies heavily on the testing framework which Jeff Moden et al set up for his excellent string splitter article[/url].
Here's the rCTE code:
CREATE FUNCTION [dbo].[DS8K_rCTEa](@pString [varchar](8000), @pDelimiter [char](1))
RETURNS...
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
October 13, 2011 at 5:59 am
codebyo (10/13/2011)
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
October 13, 2011 at 5:26 am
Bearing in mind that you are aggregating quite a few columns from a million or so rows down to 140,000, this query will always take some time to run. However,...
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
October 13, 2011 at 5:15 am
Good catch, Drew. I was about to point it out with evidence:
USE tempdb
GO
CREATE TABLE tblUCSU (strlocation VARCHAR(10), strPen INT)
INSERT INTO tblUCSU (strlocation, strPen)
SELECT 'London', 1 UNION ALL
SELECT 'New York',...
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
October 12, 2011 at 8:48 am
Never miss a (nearly) free opportunity to gather some information:
SELECT Result = NULLIF(COUNT(*),0) FROM atable
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
October 12, 2011 at 6:55 am
Viewing 15 posts - 6,601 through 6,615 (of 10,143 total)