Viewing 15 posts - 706 through 720 (of 1,396 total)
The math could look something like this
declare @data table (app_time varchar(8),
...
March 3, 2021 at 2:40 pm
Here's a simple way which avoids counting
with
a_cte as (select distinct PartId from #FeaturesvalueA),
b_cte as (select distinct PartId from #FeaturesvalueB),
x_cte as ((select * from a_cte except select *...
March 2, 2021 at 12:49 pm
Based on the data that's been provided the two tmp_day values are '01' and '02' which don't seem to vary by month. As to which column is subordinate to the...
March 1, 2021 at 4:47 pm
An alternative to PIVOT is conditional aggregation. The sample data provided only contains 1 value for 'tmp_day' which seems to not agree with the output. So I changed the sample...
March 1, 2021 at 2:47 pm
In the first paragraph it says "Windowing functions are limited to the SELECT and OVER clause..." Correction, windowing functions are permitted in both the SELECT list as well as the...
February 27, 2021 at 1:58 pm
If the array is really JSON then Mark Cowne's answer seems correct. If it's just a delimited string with repeating fixed length segments then something like this could work
February 24, 2021 at 4:31 pm
A middle way could be to use the very nice integer division Jeff uses for the time parts but then use framework functions to handle type conversions and calculation. Supposedly,...
February 23, 2021 at 6:13 pm
One "brute force" way to do this would be to expand all the date ranges and use the set operator EXCEPT to remove the (also expanded) gaps. Then the results...
February 23, 2021 at 1:39 pm
To generate a sequence why not use an explicit virtual table of the numbers themselves? Here's a .txt file with a sql script and it defines a tvf called dbo.fn1k...
February 18, 2021 at 8:39 pm
Yes plenty of time. Lots of time. Eons and eons. More than Ten Centuries 🙂 Enough to fill BIGINT. It could be dialed back as appropriate.
February 18, 2021 at 6:14 pm
The place to start imo is with this very awesome article from Jeff. I agree the code is not efficient. The key is to have a 'row goal' in...
February 18, 2021 at 5:50 pm
There were a few issues with the data which required fixing before a query could run. The VARCHAR columns require a character length, in this case I made them both...
February 17, 2021 at 10:43 pm
Hi Lonnie, thanks for the follow up. Since inside the WHILE loop the variable @i represents the theoretical cycle, perhaps it makes sense to change the WHERE clause to
February 16, 2021 at 6:32 pm
To the OP it makes clear sense no doubt. In this case the OP says they have part of the solution but only offer pictures of the problem. Maybe we...
February 14, 2021 at 4:19 pm
It seems dfp(start_dt) should've been dfp(dt) in two places. This is a really slow way to debug 🙂
with
dt_cte(dt) as (
select dateadd(month, fn.n, dfp.start_dt)
...
February 12, 2021 at 12:52 pm
Viewing 15 posts - 706 through 720 (of 1,396 total)