Viewing 15 posts - 1 through 15 (of 1,390 total)
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
DROP TABLE IF EXISTS #data_table;
GO
CREATE TABLE #data_table (
Id INT PRIMARY KEY,
Model INT,
RecordType INT,
...
June 28, 2025 at 10:37 pm
It took some testing to get the recursion working. From the reference paths it's not clear how to proceed tho. Maybe you're looking for the maximum level for each ProcedureName?
June 26, 2025 at 4:06 pm
How do I code "calc1 has error"? The above code is part of a larger code where results results are passed up from sub-query to parent query so...
May 24, 2025 at 10:18 pm
Very nice. The chess app is interesting too. Could you explain the project structure of the chess app a little more? There appears to be more than one chess engine
May 19, 2025 at 10:22 pm
"I am trying to pull the record with ID 198765 out from select query where first and last or full name does not exists."
What seems to be intended is for...
May 15, 2025 at 7:44 pm
There are examples on the internet of how to recursively assign HIERARCHYID. A while ago on this forum:
My reply in the SSC forum was based on this Stack...
May 10, 2025 at 3:58 pm
"a continuous year without any gaps" might mean different things. This assumes it to mean (any) 365 days in a row
If the EXP_DATE is null does that mean the account...
May 10, 2025 at 3:31 pm
Hey there why so hasty? If you'd fixed the script we might've seen some JM t-SQL It's been a while afaik :). The query seems nicely done tho. Presumably uniqueness...
May 6, 2025 at 3:34 pm
I have 5 country grouping tables with PK & FK foriegn key relationships that store master group names and sub group names each with the relevant country id.
There are...
May 3, 2025 at 2:17 pm
Afaik there are only two possible values for the Category column: { 'Lessthan8', 'greatherthan8' }. If that's so the query could rely on EXISTS to handle any duplication
April 24, 2025 at 10:26 pm
Regarding the precision of the data types
cast(Price as decimal(9,7)) Calculation
The line above CAST's the price (Price) to DECIMAL(9, 7). Imo this is not a good practice. When...
April 14, 2025 at 5:40 pm
My query was insufficient because it applied the factor percentage to the lagged price and not to the lagged calculated price. It seems recursion is unavoidable. This query uses a...
April 13, 2025 at 3:48 am
Why are you using these data types with this numerical precision? By making @Factor DECIMAL (9,7) and applying this percentage to a price it adds significance to decimal places to...
April 9, 2025 at 6:13 pm
Viewing 15 posts - 1 through 15 (of 1,390 total)