Viewing 15 posts - 2,206 through 2,220 (of 2,458 total)
dwain.c (7/3/2013)
We are all gentlemen here right? Is it too late to join the party, or skirmish as the case may be?
How's this one stack up in your test...
-- Itzik Ben-Gan 2001
July 8, 2013 at 12:28 pm
No problem!
-- Itzik Ben-Gan 2001
July 2, 2013 at 12:31 pm
I think this will do the trick:
-- (1) Create table and sample data:
DECLARE @x TABLE
(TableName varchar(3) not null,
BeginTime datetime not null,
EndTime datetime not null);
INSERT @x
SELECT 'T1', '2013-06-02...
-- Itzik Ben-Gan 2001
July 2, 2013 at 12:13 pm
This should be helpful too: MSDN match expression article.
-- Itzik Ben-Gan 2001
June 28, 2013 at 1:14 pm
This is an interesting read about an in-house DSS application built by NASA for their Program Managers:
The NASA Program Management Tool:A New Vision in Business Intelligence.
-- Itzik Ben-Gan 2001
June 28, 2013 at 1:09 pm
My $0.02...
The two products I have had the most experience with are Idera SQL Diagnostics Manager and Quest (Foglight & Spotlight).
I'm personally a huge fan of Idera SQL...
-- Itzik Ben-Gan 2001
June 27, 2013 at 3:13 pm
SQL_FS (6/27/2013)
SELECT
SeqNo
, coalesce(Data.startYear, src.startYear) AS [startYear]
, coalesce(data.endYear, src.endYear) AS [endYear]
, coalesce(data.Number, src.Number) AS [Number]
, src.name
FROM @tblJobHist_src src
OUTER APPLY
(
SELECT
min(startYear) AS [startYear]
, max(endYear) AS [endYear]
, sum(Number) AS [Number]
FROM @tblJobHist_src src2
WHERE
src2.name...
-- Itzik Ben-Gan 2001
June 27, 2013 at 1:17 pm
Barkingdog (6/27/2013)
-- Itzik Ben-Gan 2001
June 27, 2013 at 12:56 pm
Thank you everyone. I figured it out... Not the prettiest solution but it works.
-- With the numbers
WITH islands AS
(SELECT t1.SeqNo, t1.StartYear, t1.EndYear, t1.name
FROM @tblJobHist_src t1
JOIN @tblJobHist_src t2...
-- Itzik Ben-Gan 2001
June 27, 2013 at 11:44 am
Sean Lange (6/26/2013)
Alan have you looked at islands and gaps. I am pretty sure this is exactly what you need here.http://www.sqlservercentral.com/articles/T-SQL/71550/%5B/url%5D
It is, thanks Sean. I don't have my Ben Gan...
-- Itzik Ben-Gan 2001
June 27, 2013 at 8:17 am
Sean Pearce (6/26/2013)
Alan.B (6/26/2013)
Sean Pearce (6/26/2013)
Alan.B (6/25/2013)
-- Itzik Ben-Gan 2001
June 26, 2013 at 8:47 am
Sean Pearce (6/26/2013)
Alan.B (6/25/2013)
Which is why I included two solutions: My original solution which I believe is correct and one which was cleaner and faster than the one Michael posted.
Do...
-- Itzik Ben-Gan 2001
June 26, 2013 at 5:10 am
J Livingston SQL (6/25/2013)
Alan.B (6/25/2013)
Michael Valentine Jones (6/25/2013)
select top 1
a.[Date]
from
(
select top 1 b.[Date] from table1 b order by b.[Date] desc
union
select top 1 c.[Date] from table2 c order by c.[Date] desc
)...
-- Itzik Ben-Gan 2001
June 25, 2013 at 2:43 pm
Michael Valentine Jones (6/25/2013)
select top 1
a.[Date]
from
(
select top 1 b.[Date] from table1 b order by b.[Date] desc
union
select top 1 c.[Date] from table2 c order by c.[Date] desc
) a
order by
a.[Date] desc
I think...
-- Itzik Ben-Gan 2001
June 25, 2013 at 1:47 pm
Shadab Shah (6/25/2013)
J Livingston SQL (6/25/2013)
Shadab Shah (6/25/2013)
Is there any easy way...
-- Itzik Ben-Gan 2001
June 25, 2013 at 12:48 pm
Viewing 15 posts - 2,206 through 2,220 (of 2,458 total)