Viewing 15 posts - 1,501 through 1,515 (of 3,957 total)
It was bugging me that I did a PIVOT using a crosstab and then did an UNPIVOT. That just somehow seemed unnecessary. Sure enough, that led to a...
September 11, 2013 at 8:15 pm
DataAnalyst011 (9/11/2013)
I was hoping you might show up đŸ™‚ I'll give it a test run first thing! Thanks(!), and I'll write back soon.
Heh, heh. Flattery will get you everywhere.
Note...
September 11, 2013 at 7:56 pm
Interesting and challenging problem! Thanks for a great start to the morning.
My solution, for which I will not make any claims of trying to optimize it for performance, is:
WITH...
September 11, 2013 at 7:21 pm
DBA12345 (9/11/2013)
Let me know fi you need addiitional information.
DDL and sample data in a consumable form would be nice.
September 11, 2013 at 6:24 pm
PiMané (9/4/2013)
ChrisM@Work (9/4/2013)
-- sample data
;WITH gennum (tollnum, n1, n2, n3) AS (
SELECT 800123, 1234, 1235, 1236 UNION ALL
SELECT 999123, 9876, 9875, 9874
)
-- solution
SELECT g.tollnum, d.code
FROM gennum...
September 11, 2013 at 3:54 am
Paul - I get fairly stable results with this test harness. Can you confirm?
I am also running on a SQL Server that is fairly quiescent (no other processes running).
--=====...
September 10, 2013 at 7:36 pm
My personal preference is to do this with a CROSS APPLY:
WITH SampleData AS (
SELECT RowID, DateStamp=CAST(DateStamp AS DATE), PrevStatus, CurrentStatus
FROM (VALUES
(1, '6/1/2012',...
September 10, 2013 at 7:22 pm
Perhaps it is overkill but is this a case where "fudge rounding" would help?
http://www.sqlservercentral.com/articles/Financial+Rounding/88067/
September 10, 2013 at 6:46 pm
Interesting that this related thread should appear just now:
http://www.sqlservercentral.com/Forums/Topic1492737-3077-1.aspx?Update=1
September 10, 2013 at 6:38 pm
I think I'm missing something here but for what it's worth:
WITH SampleData (start_time, end_time) AS (
SELECT '22:00', '05:59'
UNION ALL SELECT '12:00', '18:59'
)
SELECT start_time, end_time
,ElapsedMin=
...
September 10, 2013 at 6:34 pm
You might want to consider using the CROSS APPLY VALUES approach to UNPIVOT (see my signature links) and do it this way (works on SQL 2008 and uses Alan's set...
September 10, 2013 at 6:21 pm
Jeff Moden (9/10/2013)
dwain.c (9/10/2013)
(you forgot my version in your test harness).[/code]
Who you talking to, Dwain?
Paul.S here: http://www.sqlservercentral.com/Forums/FindPost1493158.aspx
September 10, 2013 at 5:53 pm
Try running this 3-4 times and you'll see that the winner bounces around among the 3 (you forgot my version in your test harness).
--===== Conditionally drop the test table to...
September 10, 2013 at 7:21 am
Jeff Moden (9/9/2013)
PRINT '========== Another Integer Math Method =========='SET STATISTICS TIME ON;
SELECT @BitBucket = RIGHT(1000000000 + C1*1000 + C2, 9)
FROM #TestTable;
SET STATISTICS TIME OFF;
Oh,...
September 9, 2013 at 11:43 pm
As you said, in the interests of science, I removed the duplicate scenario in your test harness, added back my original at the end and included an extra one based...
September 9, 2013 at 11:29 pm
Viewing 15 posts - 1,501 through 1,515 (of 3,957 total)