Viewing 15 posts - 16 through 30 (of 4,083 total)
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
My primary goal is to meet the stated business requirements for the code, which I don't believe your code does. You will list the "truePct" for even a single...
October 8, 2024 at 6:04 pm
Maybe this?:
SELECT poll_id ,start_date,end_date,
candidate_name, sample_size,
(select avg(pp2.pct) from [president_polls] pp2
where pp2.state = pp.state and pp2.poll_id = pp.poll_id
...
October 8, 2024 at 3:11 pm
Here is the beginning of a solution. It uses James F. Allen's (no relation) Interval Algebra: https://en.wikipedia.org/wiki/Allen%27s_interval_algebra.
The amount used from each bin depends on the relation between the purchases...
October 3, 2024 at 8:32 pm
Viewing 15 posts - 16 through 30 (of 4,083 total)
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy