Viewing 15 posts - 1 through 15 (of 1,403 total)
Afaik if the column list is variable it's not possible to unpivot without dynamic SQL. On a per table (or schema) basis if the columns are known then you could...
March 19, 2026 at 12:55 pm
Yes that answers it. It seems possible to create an iTVF per table/schema (if it's hard coded explicitly referencing columns and table(s)) that gives users what they're looking for. Not...
March 7, 2026 at 3:40 am
The design is annoying but maybe not unfixable if you could encapsulate access (queries, views, etc.). Imo the bigger issue is whether the table(s) store when things happened (datetime per...
March 6, 2026 at 5:24 pm
Hi Pieter,
Once you unpivot into (Symptom, Grade, Causality, Relatedness) you’ve gotten rid of the original “slot” number (the 1, 2, 3 suffixes). Maybe that matters? It might if you later...
March 6, 2026 at 3:09 pm
Maybe the issue is the query could possibly be more efficiently evaluated if expressed as two queries. It always depends on the actual situation with cardinalities and indexes etc. If...
February 7, 2026 at 12:14 am
January 14, 2026 at 1:17 am
Sure redesign if possible. As far as the task at hand it depends on the number of rows really. If there are a good many rows then allocating a temp...
January 7, 2026 at 8:09 pm
Ha yeah I was reluctant to test it out. Sorry for the syntax issues. Originally I had a table CREATE statement but then switched to SELECT INTO because that's more...
November 14, 2025 at 11:38 pm
How about creating a giant temp table from a CROSS JOIN using 2 fnTally functions. Then join the temp table to itself forcing a HASH JOIN with tiny memory grants...
November 13, 2025 at 10:51 pm
Assuming this is dev or the table is empty, DROP and recreate with the proper column type and default. Something like this
drop table if exists dbo.latest_info;
go
create table...
November 9, 2025 at 8:50 pm
You're looking to set the DEFAULT value of the publish_date column to be the current Unix timestamp? If so the proper column type would be BIGINT. SQL Server’s native datetime...
November 9, 2025 at 8:20 pm
Summary
+ Input: long varchar text; max line width W.
+ Walk left-to-right, one word at a time.
+ Separators: space; CR/LF are hard line breaks.
+ For each word:
...
November 7, 2025 at 3:14 am
If there are alternate code paths which depend on the client then spare a thought for the optimizer. This pattern implies parameter sniffing imo. To the extent there are separate...
September 23, 2025 at 3:53 pm
Ah yes, I see that now. Thanks Jeff. In my head I did check to make sure the dates within the partition were unique and then told myself "nothing to...
September 13, 2025 at 12:47 pm
Yes I agree pietlinden has the correct approach imo. SUM OVER provides a running total without recursion
select *, sum(OpenOpps+CreatedOpps+WonOpps+LostOpps) over (partition by Division order by [Date]) running_total
from...
September 12, 2025 at 10:49 pm
Viewing 15 posts - 1 through 15 (of 1,403 total)