Viewing 15 posts - 4,111 through 4,125 (of 8,761 total)
Another quick solution, similar to John's apart from this one is counting in both directions
😎
USE tempdb;
GO
SET NOCOUNT ON;
/* SAMPLE DATA SET */
;WITH SAMPLE_DATA(RN,NAME) AS
(
SELECT 1,'Mary'...
January 4, 2016 at 6:12 am
Raastarr (1/4/2016)
Thanks for all of the responses.I've gone with the first solution from Eirikur as it did exactly what was required :-).
You are very welcome and thanks for the feedback.
😎
January 4, 2016 at 4:55 am
Thank you Mickey for this article, good Monday morning reading.
The part I find hard to agree with is "When to Use Scalar Functions", particularly when the example given can easily...
January 4, 2016 at 2:01 am
Jeff Moden (1/3/2016)
January 3, 2016 at 11:42 pm
Good job with the DDL and the sample data Raastarr, made this very quick and straight forward question to answer;-)
😎
There are few ways of doing this, here is the first...
January 3, 2016 at 2:11 pm
Timing the different methods using the previously posted test data set
😎
Test harness
-- TEST: Different ways of calculating duration
-- DATA SET: ...
January 3, 2016 at 8:01 am
This is not possible in this way, the over clause cannot be used with user defined functions.
😎
January 3, 2016 at 7:23 am
Jeff Moden (1/1/2016)
Eirikur Eiriksson (12/31/2015)
Careful here Jeff, the type cast to decimal is expensive, consider using float which does not need a type cast is less costly.
Understood. FLOAT only...
January 2, 2016 at 7:24 am
Orlando Colamatteo (1/1/2016)
Eirikur Eiriksson (12/21/2015)
GilaMonster (12/21/2015)
I don't think that functions have optional parameters that can be left out of the call
That's correct, neither optional parameters nor default values can be...
January 2, 2016 at 4:37 am
Jeff Moden (1/1/2016)
January 2, 2016 at 1:29 am
drew.allen (12/31/2015)
Jeff Moden (12/30/2015)
Here's the code I wrote last night with the validation checks that I added today. Details are in the comments in the code.
GREAT! But suppose your...
January 1, 2016 at 4:40 pm
Ed Wagner (12/31/2015)
December 31, 2015 at 10:53 am
Happy new year and may the source be with you.
😎
December 31, 2015 at 8:30 am
Jeff Moden (12/30/2015)
--=================================================================================================-- Calculate the sum of the durations
--=================================================================================================
--===== Calculate the total duration in decimal hours.
-- This won't break if...
December 31, 2015 at 4:24 am
Viewing 15 posts - 4,111 through 4,125 (of 8,761 total)