Viewing 15 posts - 2,491 through 2,505 (of 10,143 total)
mattech06 (5/27/2015)
what do you mean by actual execution plan?
The statement works - just if the result set (100+) is bigger than normal it takes over a minute whilst under...
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
May 27, 2015 at 8:11 am
devsql123 (5/27/2015)
Currently my 1st Update statement has Isnull(td.IsPosted, 0) = 0 in 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
May 27, 2015 at 7:49 am
Your CASE expressions don't look correct with multiple AND / OR with no defining parens.
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
May 27, 2015 at 7:49 am
mattech06 (5/27/2015)
SELECT
r.dbPatID,...
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
May 27, 2015 at 7:44 am
UPDATE t SET
t.AODYD = CASE WHEN ISNULL(td.IsPosted, 0) = 0 THEN td.ODYD ELSE t.AODYD END,
t.DAODYD = CASE WHEN ISNULL(td.IsPosted, 0) <> 0 THEN td.ODYD ELSE t.DAODYD END
FROM #ReportData...
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
May 27, 2015 at 7:17 am
DECLARE @txtMessageText VARCHAR(MAX)
SET @txtMessageText = 'QU - 119480,8377,EX,0810,4300,LT,3,154,1,0,15005,08R,17'
-- NOTE: STUFF() removes the final character from the string. Since the string is
-- reversed, the expression is STUFF(expression,1,1,'')
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
May 27, 2015 at 5:30 am
-- ALWAYS figure out a SELECT to test the update.
SELECT
b.*, a.*
FROM dbo.CardioStaffClinical a
INNER JOIN (
SELECT
[Name (Username):],
Last_Name2 = SUBSTRING([Name (Username):], 1, x.CommaPos-1),
First_Name2 = SUBSTRING([Name (Username):], x.CommaPos+3, 8000)
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
May 27, 2015 at 5:14 am
Food for thought:
SELECT DATEDIFF(millisecond,'20150521','20150522') --86400000 ms in a day
SELECT
RightNow, RightNowNumeric, RightNowDecimalPart, RightNowIntegerPart,
ReconstructedDate = DATEADD(day,RightNowIntegerPart,0),
ReconstructedDateTime = DATEADD(millisecond,86400000*RightNowDecimalPart,DATEADD(day,RightNowIntegerPart,0))
FROM (
SELECT
RightNow,
RightNowNumeric = CAST(RightNow AS NUMERIC(18,12)),
RightNowDecimalPart = CAST(RightNow AS NUMERIC(18,12))%1,
RightNowIntegerPart = CAST(CAST(RightNow...
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
May 21, 2015 at 3:39 am
Maddave (5/20/2015)
Pefect! That's what I need. Thank you so much.
You're welcome. Don't settle for the first attempt though;
Make it work (see above)
Make it fast (see next query)
Make it pretty...
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
May 20, 2015 at 8:25 am
OK, think I've got it now:
SELECT j.*,
s1.Gate1ID, s1.Gate1ProcessId,
s2.Gate2ID, s2.Gate2ProcessId,
s3.Gate3ID, s3.Gate3ProcessId,
s4.Gate4ID, s4.Gate4ProcessId,
s5.Gate5ID, s5.Gate5ProcessId
FROM #Jobs j
LEFT JOIN (
SELECT JobId, n
FROM (
SELECT JobId, cnt...
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
May 20, 2015 at 7:23 am
Or like this?
SELECT j.*,
Gate1ID = (CASE WHEN s.GateId = 1 THEN 1 ELSE NULL END), Gate1ProcessID = (CASE WHEN s.GateId = 1 THEN s.ProcessID ELSE NULL END),
Gate2ID = (CASE...
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
May 20, 2015 at 5:58 am
Like this?
SELECT j.*,
Gate1ID = s1.GateId, Gate1ProcessID = s1.ProcessID,
Gate2ID = s2.GateId, Gate2ProcessID = s2.ProcessID,
Gate3ID = s3.GateId, Gate3ProcessID = s3.ProcessID,
Gate4ID = s4.GateId, Gate4ProcessID = s4.ProcessID,
Gate5ID = s5.GateId, Gate5ProcessID = s5.ProcessID ...
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
May 20, 2015 at 5:44 am
Sean Lange (5/18/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
May 18, 2015 at 10:11 am
Compare the estimated plans for the following statements:
SELECT i.*
FROM @invoice i
WHERE i.org_id in (select item from dbo.DelimitedSplit8K(@org_list,','))
SELECT i.*
FROM @invoice i
INNER JOIN dbo.DelimitedSplit8K(@org_list,',') d ON d.item = i.org_id
In the first plan,...
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
May 18, 2015 at 9:52 am
maheendra.puttareddy (5/18/2015)
Thank you very much this is really helpful to meRegards
Maheendra Reddy
You're very welcome, and thank you for the nice feedback.
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
May 18, 2015 at 8:29 am
Viewing 15 posts - 2,491 through 2,505 (of 10,143 total)