Viewing 15 posts - 16 through 30 (of 4,087 total)
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
You state that, "Often, we encounter situations where we need to loop through a dataset to process or update records iteratively." However, the sample that you use can trivially be...
October 16, 2024 at 3:07 pm
This is where it would help to have sample data. There are 9 different overlapping relationships, and each usage can have multiple pieces with various instances of those 9 relationships. ...
October 16, 2024 at 2:13 pm
Did you read the response I made to your other thread? https://www.sqlservercentral.com/forums/topic/which-is-the-active-price-for-each-ingredient#post-4465061
Drew
October 10, 2024 at 1:59 pm
Please use the {;}Code
button when posting code.
October 9, 2024 at 2:45 pm
Viewing 15 posts - 16 through 30 (of 4,087 total)