Viewing 15 posts - 6,376 through 6,390 (of 10,143 total)
The recursive CTE is used for generating rows - and it's a massively expensive way to do this. In 2K8 or higher, row constructors would be much cheaper
VALUES((1),(2),...)
In 2k5,...
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 13, 2012 at 3:09 am
Jeff Moden (2/13/2012)
ChrisM@home (1/18/2012)
jennigirl (1/18/2012)
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 15, 2012 at 1:51 am
Cadavre (12/9/2011)
ChrisM@Work (12/9/2011)
Although it's less elegant than Cadavre's code, it's likely to perform a little faster.
Agreed 100%. Generally I use cross-tab queries to pivot data, I showed the syntax for...
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
December 9, 2011 at 8:49 am
The method you are using - correlated subqueries - is similar in layout to a cross-tab, but check out the real thing for performance:
SELECT
ListingID,
Photo01 = MAX(CASE WHEN Priority =...
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
December 9, 2011 at 8:37 am
Divine Flame (12/9/2011)
GilaMonster (12/9/2011)
Divine Flame (12/9/2011)
What is the average row cont in sys.dm_io_pending_io_requests ??On SQL 2000?
lol :-D, No way . He has not mentioned that he is using SQL...
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
December 9, 2011 at 4:05 am
Can you confirm that you are using SQL Server 2000?
Have a quick read of the link "here" in my sig, it will help you frame your question for a better...
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
December 9, 2011 at 4:04 am
SQLRNNR (12/8/2011)
ChrisM@Work (12/8/2011)
SQLRNNR (12/7/2011)
Took the plunge on 70-451Nice one, Jason!
Thanks
Was the braindump useful?:-D
It was just small enough to fit :hehe:
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
December 9, 2011 at 3:17 am
You could use the OUTPUT clause:
DROP TABLE #MemberEnrolments
CREATE TABLE #MemberEnrolments (MemberID INT NOT NULL, EnrollmentID INT NOT NULL, enrolmentStartDate DATE NOT NULL, primaryflag BIT)
ALTER TABLE #MemberEnrolments --WITH NOCHECK
ADD CONSTRAINT...
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
December 8, 2011 at 10:24 am
mario.balatellii (12/8/2011)
Or may be i will have sql job which will transfer the data into a table in a database. What...
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
December 8, 2011 at 6:24 am
Probably easiest if you run the results into a local temp table...
SELECT ... INTO #Temp FROM ...
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
December 8, 2011 at 5:58 am
-- change this
update TestA set TestA.Column5 = TestB.Column5
from TestA inner join TestB
on TestA.Column1 = TestB.Column1
and TestA.column2 = TestB.Column2
and TestA.Column3 = TestB.Column3
-- to this
SELECT <<primary key from table a>>, b.Column5
INTO #Temp
FROM...
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
December 8, 2011 at 4:43 am
SQLRNNR (12/7/2011)
Took the plunge on 70-451
Nice one, Jason!
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
December 8, 2011 at 4:01 am
mario.balatellii (12/7/2011)
thanks for this Chris. I will try this at work tomoro and let you know how it goes. Much appreciated
You're welcome Mario. You will need to change the 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
December 7, 2011 at 10:12 am
Crosstab version:
SELECT
[Type]= MAX(CASE WHEN en.[Entity name] = 'Type' THEN Attribute END),
[Bank name]= MAX(CASE WHEN en.[Entity name] = 'Bank name' THEN Attribute END),
[Merchant code] = MAX(CASE WHEN en.[Entity...
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
December 7, 2011 at 10:07 am
mario.balatellii (12/7/2011)
I will be hard coding the headings and I want the respective data for the row under that heading.
No problem. Don't forget to shape your sample data so 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
December 7, 2011 at 9:36 am
Viewing 15 posts - 6,376 through 6,390 (of 10,143 total)