Viewing 15 posts - 226 through 240 (of 1,402 total)
What happens if/when there are gaps in the CreatedDate column for particular CustomerID's?
May 23, 2023 at 2:57 pm
additional JOIN's and CROSS APPLY's apply to the rectangle defined immediately above it (in order of appearance) within the FROM clause
May 21, 2023 at 1:43 pm
Thinking outside the box is part of the reason I can solve problems fairly quickly as I use approaches that are not always predefined.
Thinking inside rectangles is how I...
May 21, 2023 at 1:29 pm
The link Steve Collins posted is interesting. Got through it, and while I don't quite agree that stored procs create a strangler pattern, I do think in the high...
May 20, 2023 at 12:45 pm
Check out this video. The speaker gives a whole laundry list of reasons, a litany of epiphanies, on why SQL Server is not well suited for transaction processing. Instead, the...
May 18, 2023 at 6:06 pm
It seems you could use COUNT in the SELECT list. COUNT always returns an INT even if the FROM clause returns no rows
declare
@max_num ...
May 17, 2023 at 9:47 pm
This is a tricky query. You have 2 separate aggregations for which the results are then LEFT JOIN'ed by rank. What I'm not understanding in my own code is why...
May 11, 2023 at 1:44 pm
Does the query contain WITH (NOLOCK)?
May 9, 2023 at 9:54 pm
Msg 8144, Level 16, State 3, Line 38 Procedure or function string_split has too many arguments specified.
Completion time: 2023-05-08T16:53:02.0901322+05:30
Please run this code and paste the results. Please replace 'Your-Database-Name'...
May 8, 2023 at 11:56 am
An alternative
drop table if exists #title_one_space;
go
select * into #title_one_space from (values
('one word')
,('one word two words')
,('one word two words three words')
,('one word two words three words four'))...
May 7, 2023 at 12:30 pm
It shouldn't be necessary to calculate the LAG twice. Like Drew's code this factors out another CTE
WITH
ctePrev AS
(--==== Get the previous Prices...
April 25, 2023 at 1:37 pm
This is interesting. Nicely done Jeff. The AI (ChatGPT-4) was unable to make any improvements to the query marked as the solution. It never comes up with nothing so it...
April 25, 2023 at 12:38 pm
The prompt was based on minimal code
this sql code omits a 2nd column with which we could order the rows. Could you add a date column...
April 25, 2023 at 1:10 am
Without a second column containing a date (or some ordinal data type) there's no way to ensure the row ordering is consistent. Thanks ChatGPT for fixing the data. You could...
April 24, 2023 at 10:18 pm
No idea what's meant by the rounding. Presumably (to get the correct output) there's a '<=' inequality. To handle the range between 174 and 176 you could create a partial...
April 24, 2023 at 9:47 pm
Viewing 15 posts - 226 through 240 (of 1,402 total)