Viewing 15 posts - 1 through 15 (of 3,497 total)
You use the (longitude, latitude) to create/define a @Point. and then you use STDistance to calculate the distance between them.
STDistance (geography Data Type) - SQL Server | Microsoft Learn
April 2, 2026 at 12:46 am
Day late probably, but one thing to remember is that
<Aggregate> OVER (PARTITION BY <columnName>)
is the windowing version of
<Aggregate> FROM... GROUP BY <columnName>
and windowing functions do not reduce the number of...
March 30, 2026 at 4:38 pm
Something like this?
SELECT c.CustomerID, MAX(c.CallDate), STRING_AGG(c.Notes,' | ')
FROM (VALUES
(433, '2018-11-06 11:08:12.793', 'Customer called'),
(433, '2018-11-06 11:08:12.793', 'Customer left...
March 24, 2026 at 6:03 pm
Dave,
Got some more data? Enough to weed out the false positives etc?
March 23, 2026 at 11:28 pm
Like this?
SELECT c.CustomerID, c.CallDate, STRING_AGG(c.Notes,'|')
FROM (VALUES
(433, '2018-11-06 11:08:12.793', 'Customer called'),
(433, '2018-11-06 11:08:12.793', 'Customer left message')
) c(CustomerID, CallDate, Notes)
GROUP...
March 23, 2026 at 9:17 pm
My code basically looks for the Causality or Relatedness columns and then counts back from there. That was the only sensible way of doing it. The weird 1/3 or whatever......
March 19, 2026 at 3:53 pm
just wondering. There's not really a way to achieve this without dynamic SQL, right? I don't think so because you don't know beforehand how many of the repeating groups there...
March 18, 2026 at 7:23 pm
Your sample desired output looks a lot like a PowerPivot in Excel. So I don't think trying to write a query for this is maybe what you want. (or is...
March 16, 2026 at 11:26 pm
Okay, I sorted it out. It's not ideal yet... It should be a stored procedure and should receive the tablename containing the data as input. Just because it's usually called...
March 12, 2026 at 3:52 am
I was thinking of writing an iTVF to basically do the CROSS APPLY stuff for me. I'd do it tonight, but SQL Saturday is tomorrow... so I'll try it this...
March 7, 2026 at 3:51 am
The basic pattern is SymptomName, Causality#, Relatedness#
It's oncology stuff, so there are no other column names like that. Causality and Relatedness all have numeric suffixes from 1 to however many...
March 6, 2026 at 7:42 pm
The basic pattern is SymptomName, Causality#, Relatedness#
It's oncology stuff, so there are no other column names like that. Causality and Relatedness all have numeric suffixes from 1 to however many...
March 6, 2026 at 7:42 pm
Oh, I STRING_AGG WITHIN GROUP was a good catch. Thanks for that!
The bigger problem is that I have lots of tables with the same hideous design. That's what I was...
March 6, 2026 at 3:42 pm
Funnily enough, I have that book too. Guess I should be brave and actually open it!
February 17, 2026 at 1:11 am
Kinda to answer my own question... I'd definitely recommend reading Star Schema: The Complete Reference before reading Data Warehouse Toolkit. Complete Reference starts from a much less theoretical place, so...
February 10, 2026 at 8:19 pm
Viewing 15 posts - 1 through 15 (of 3,497 total)