Viewing 15 posts - 1 through 15 (of 3,489 total)
(Apparently, I like to double-post... and the checker here doesn't work.)
March 7, 2026 at 3:51 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
Oh that! LOL
Thanks Frederico!
Apologies to the OP, rcrock, for sorta hijacking his thread.
Here's the fixed code:
--desc: ugly search scans all string column types for a specific value
IF...
December 4, 2025 at 9:38 pm
??
I'm confused. I copied and pasted your code and tried to run it. It returns this error:
Msg 156, Level 15, State 1, Procedure sp_uglysearch, Line 84 [Batch Start Line 7]
Incorrect...
December 3, 2025 at 12:49 am
This is what I came up with... (btw... with that many points, you can't post CREATE TABLE etc statements for people?)
--CREATE TABLE LogTable (tableName NVARCHAR(50), columnName NVARCHAR(50));
--GO
--...
November 30, 2025 at 3:26 am
Sounds like you have serious design issues in your database. I don't envy you one bit.
But you can use a query like this to get all the column names and...
November 28, 2025 at 8:42 pm
I started reformatting the code... here's my reformat (FWIW):
SELECT
sa.partid AS ALLOC_Part,
sa.quantity,
sa.ordertype,
sa.worksorderid,
sa.reference,
sa.stockvalue,
apm.partdesc,
soi.orderid,
soi.itemnumber,
soi.partid AS SOI_Part,
so.traderid,
t.[name],
u.[name] As SalesRep,
MAX(sub.Max_Batchvalue) AS High_Batchvalue
FROM stockallocations sa
INNER JOIN worksorders wo ON
sa.worksorderid = wo.id
INNER JOIN allpartmaster...
November 24, 2025 at 3:36 pm
The most obvious thing is that you're using INNER joins everywhere. If you want to keep all the records from one table, you need to OUTER join from that to...
November 24, 2025 at 12:21 am
What happened when you tried it?
with only 15 records, I'm not sure you'll see a huge difference, but give it a try and record both times. I didn't write this...
November 8, 2025 at 4:35 pm
Generally speaking, if you can provide a clear question, some sample data (create table and insert scripts), and an expected output, you can ask all kinds of questions and get...
October 23, 2025 at 11:52 pm
Viewing 15 posts - 1 through 15 (of 3,489 total)