Viewing 15 posts - 1 through 15 (of 4,075 total)
Sorry, sorry my apologies. I didn't catch the inconsistency. The green arrows in the image you posted only point up! Afaik that's the part I missed. Once there's an...
December 23, 2024 at 5:10 pm
Here is a slightly different approach. There is no discernable difference in the performance for the sample data. When I add a primary key on Number and StartTime, this approach...
December 6, 2024 at 5:21 pm
Another thing. In cases such as this, it's usually best to start a new post and reference the old post instead of hijacking the original post. Otherwise it can get...
December 6, 2024 at 4:44 pm
The problem is that your data is stored as closed intervals (both end-points are included in the interval) when this issue requires half-closed intervals (only one end-point is included in...
December 6, 2024 at 4:41 pm
LAG, which compares rows within the window partition, is not strictly necessary imo. JOIN relates to a lookup table containing the values sequence. Also, I'm not a fan of...
November 27, 2024 at 3:41 pm
ORs can be quite expensive, so I wrote up this version that uses a different method. This would probably perform better if you had a separate table that defined the...
November 26, 2024 at 10:23 pm
ID isn't necessary. The combination of CommunityID and PersonID should be unique, because a person cannot belong to a community multiple times. Since you already have a unique key, I...
November 26, 2024 at 9:53 pm
First, the VALUES
clause can take more than one set of values, so you can take advantage of that to make your script MUCH more concise.
insert into #T(VisitID,...
November 14, 2024 at 8:06 pm
Thanks for the critical feedback! I appreciate your point, but the intent of my script wasn't to compare performance between the two methods. It was focused on providing a...
October 24, 2024 at 4:52 pm
In case if you have missed, I did mention "You can also use STRING_AGG (SQL Server 2017+) to achieve same results."
No, I caught that. You stated that there is...
October 24, 2024 at 2:11 pm
I've almost completely abandoned this approach since the introduction of STRING_AGG()
, because it's just so much simpler to implement (and therefore easier to understand). You need to offer a compelling...
October 23, 2024 at 8:49 pm
From the T-SQL Documentation: Slash Star (Block Comment) (Transact-SQL)
"Nested comments are supported. If the /* character pattern occurs anywhere within an existing comment, it is treated as the start...
October 22, 2024 at 7:50 pm
It looks like there may also be an error in your logic. ANDs are evaluated before ORs, and, based on your layout, that's not how you want the WHERE clause...
October 18, 2024 at 11:02 pm
Not sure why you failed to post sample data and expected results, but you did...
October 16, 2024 at 6:53 pm
An IF...ELSE
is a Control-of-Flow element. It cannot be used inside of atomic statements, because that would make them non-atomic. I believe that WHERE
clauses can only appear in atomic...
October 16, 2024 at 5:12 pm
Viewing 15 posts - 1 through 15 (of 4,075 total)