Viewing 15 posts - 9,856 through 9,870 (of 10,143 total)
karthikeyan (11/22/2007)
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 2, 2008 at 8:01 am
There's another way of doing this:
SELECT dbJobSkillGrp,
SUM(CASE WHEN dbJobCreateDate BETWEEN @StartDate AND @EndDate THEN 1 ELSE 0 END) AS 'JobsCreated',
SUM(CASE WHEN dbJobFillDate BETWEEN @StartDate AND @EndDate THEN 1 ELSE...
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 2, 2008 at 7:47 am
Hi
Here's a suggestion, I'm not sure if it will be sympathetic to your environment but worth a try:
SELECT {col1, Col2, ...Coln}
FROM {Table} a
LEFT JOIN (
SELECT 2 AS Department, 'B'...
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
April 25, 2008 at 6:33 am
thehollis (4/22/2008)
Example
Department Category1 Category2 ...
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
April 25, 2008 at 4:56 am
If you are likely to use your cluster code translations again, you could put them into a table and use UPDATE...FROM
CREATE TABLE #TranslateClusterCodes (CLUSTER_CODE char(3), TGI_CLUSTER_CODE char(2))
INSERT INTO #TranslateClusterCodes (CLUSTER_CODE,...
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
April 23, 2008 at 8:11 am
RyanRandall (4/21/2008)
This uses explicit conversion, rather than implicit[/code]
Chris
I don't see any implicit conversion. Are you suggesting that what I posted is implicit?
Hi Ryan
Not at all - CAST() is explicit conversion....
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
April 21, 2008 at 7:38 am
This uses explicit conversion, rather than implicit:
DECLARE @CharDate CHAR(23)
SET @CharDate = '20081011192921703'
SET @CharDate = STUFF(STUFF(STUFF(STUFF(STUFF(STUFF(@CharDate, 5, 0, '-'), 8, 0, '-'), 11, 0, ' '), 14, 0, ':'), 17, 0,...
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
April 21, 2008 at 4:54 am
Have you tried Sergiy's suggestion?
SELECT * FROM (
SELECT RIGHT(SPACE(32) + RTRIM(LTRIM(' 1 ')), 32) AS TradeReference UNION ALL
SELECT RIGHT(SPACE(32) + RTRIM(LTRIM('12345678901234567890123456789012')), 32) UNION ALL
SELECT RIGHT(SPACE(32)...
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
April 21, 2008 at 4:33 am
I just had a haircut! 😛
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
April 17, 2008 at 9:51 am
Mark Markov (4/17/2008)
I am almost sure that noone who is going to interview me will see this thread. So far...
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
April 17, 2008 at 8:23 am
If you don't like temp. tables, this is the same code using derived tables:
select a.People_Number, a.Web_Role, d.Web_Role
from #TheTable a, (select a.People_Number,a.Web_Role
from #TheTable a, (select People_Number
from #TheTable
group by People_Number
having 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
April 15, 2008 at 12:44 am
CREATE TABLE #TheTable (People_Number int, Web_Role int)
INSERT INTO #TheTable (People_Number, Web_Role)
SELECT 100, 3 UNION ALL
SELECT 100, 7 UNION ALL
SELECT 200, 5 UNION ALL
SELECT 200, 3 UNION ALL
SELECT 300, 8 UNION...
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
April 15, 2008 at 12:15 am
karthikeyan (4/14/2008)
Every Database developer should have some thoughts on performance.some people might have worked/faced this kind of situation,if they share their real experience then people like me will get some...
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
April 14, 2008 at 8:14 am
Davidyard
One step at a time: introduce the aggregate last.
SELECT
[Incident #],
[Urgency ID],
[Group Name],
[Open Date & Time],
[SMDBA_Incident_Age] = DATEDIFF(d, [Open Date & Time], GETDATE())-----ERROR is at this line
FROM [_SMDBA_].[Incident_Age]
-- Is this...
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
April 14, 2008 at 7:36 am
The poster's explanation is an opinion which Shaun happens to agree with.
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
April 8, 2008 at 5:14 am
Viewing 15 posts - 9,856 through 9,870 (of 10,143 total)