Viewing 15 posts - 3,811 through 3,825 (of 10,143 total)
Jeff Moden (1/2/2014)
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 3, 2014 at 2:39 am
pietlinden (1/2/2014)
I think that's how I got the random number of records per enrollment so that the distribution is irregular. I noticed that Chris's code returns the same number...
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 3, 2014 at 2:37 am
sayedkhalid99 (1/3/2014)
... after 1.3 , 1.5 shall come and then 1.10....
1.10 usually sorts before 1.3. If this is the case, try casting to decimal:
SELECT * FROM @Result ORDER BY CAST(Serial...
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 3, 2014 at 1:54 am
dwain.c (1/2/2014)
ChrisM@Work (1/2/2014)
... for now we've got a rusty car wheel, a piece of lime green chalk and a small fish!No small fish allowed.
Missed the prefix "sail" 😛
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 3, 2014 at 1:47 am
dwain.c (1/2/2014)
pietlinden (1/2/2014)
But what if it's a Babelfish and I need it to speak T-SQL?You can use:
EXEC sp_translate @SourceLanguage='gibberish', @TargetLanguage='T-SQL'
This comes in very handy when all you've got for a...
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 3, 2014 at 1:46 am
That will give you date but not time. The code I posted returns datetime, from which you can extract both date and time
CAST(CAST(CounterDateTime AS CHAR(23)) AS DATETIME)
and it's intuitive too...
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 3, 2014 at 1:41 am
SELECT
x.CounterDateTime, -- stare & compare
[Date] = CONVERT(VARCHAR,x.CounterDateTime,101),
[Time] = RIGHT(CONVERT(VARCHAR,x.CounterDateTime,0),7)
FROM (-- "Native" CounterDateTime looks similar to this
SELECT CounterDateTime = '2013-12-30 12:09:00.123' + CHAR(10)) d
CROSS APPLY (-- so convert it...
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 2, 2014 at 8:25 am
Rando (1/2/2014)
Again, I'm just looking for the results to be the following;
Date: 12/30/2013
Time:...
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 2, 2014 at 7:11 am
kapil_kk (1/2/2014)
ChrisM@Work (1/2/2014)
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 2, 2014 at 7:09 am
FOR XML PATH is used for concatenating values from different rows - the value you are attempting to assemble is a concatenation of values on the same row. Just use...
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 2, 2014 at 6:55 am
Just a thought...what's this meant to do?
(dbAddDate >= '2013-01-01' OR '2013-01-01' = '')
AND (dbAddDate <= '2013-12-31' OR '2013-12-31' = '')
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 2, 2014 at 5:52 am
Grab actual query plans for whatever query is responsible for "Existing orders with 200 lines take 10 minutes to retrieve."
One plan from when response is fast, one plan 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
January 2, 2014 at 5:05 am
Try this as a test:
SELECT
dbPatID,
dbAddDate,
dbStaffLastName,
RefTypeWord = MAX(RefTypeWord)
FROM EPSReferralKPIs
WHERE
dbAddDate >= '2013-01-01' OR '2013-01-01' = ''
AND dbAddDate <= '2013-12-31' OR '2013-12-31' = ''
AND dbStaffLastName IN ('Swanepoel','Patient','Pelletti','Ray','Qureshi','Grobler','Hedborg','De Kock','Lima','Check...
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 2, 2014 at 4:59 am
What about the other columns? Can you show a few rows of what you have and what you would like to see? Remember - we can't see what you can,...
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 2, 2014 at 4:43 am
Here's an alternative to Abu Dinas' suggestion;
SELECT
b.dbPatID,
b.dbPatFirstName,
b.dbPatLastName,
x.dbStaffLastName,
b.TotTot
FROM EPSAgedBalances b
CROSS APPLY (
SELECT TOP 1 dbStaffLastName
FROM EPSAllContracts c
WHERE c.dbPatID = b.dbPatID
) x
WHERE b.TotTot < 0
Not...
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 2, 2014 at 2:30 am
Viewing 15 posts - 3,811 through 3,825 (of 10,143 total)