All Questions
Tagged with recursive sql-server-2008-r2
7 questions
-1
votes
3
answers
2k
views
Create parent node and parent id [closed]
I have a table which contains id, nodeid, nodevalue, and nodelevel columns.
Now I want to create new temp column ParentnodeId.
I tried using CTE but not getting the correct result.
Id Nodeid ...
4
votes
1
answer
11k
views
Recursive cte avoiding loops
I'm trying to write a recursive CTE to explore a workflow system. Unfortunately, I'm getting maximum recursion errors due to loops:
with cteActs as
(
select a.id as [id], aa.TASKNEXTID as [...
0
votes
2
answers
311
views
Calculate Value Dynamically
I need to calculate a value by using it's previous value * ColumnX
Here is the formula:
DividendReinvested = "Previous DividendReinvested" * (1+ValuationPercChange/100)
Can I do this without a loop?...
1
vote
3
answers
646
views
SQL Server - How to solve FIFO Cost of OHB... function, cursor,?
SQL Server 2008R2 - Need to solve FIFO cost of items on hand.
To do this I need to add the cost for the most recent receipts quantity up to the current on hand balance(OHB).
So lets say I have
...
3
votes
0
answers
52
views
Why does retrieving fewer rows take longer? [duplicate]
I have a view that (left outer) joins multiple recursive CTEs. There are about 10k rows. The results of running SELECT * FROM MyView ORDER BY MyPrimaryKey, with statistics time and io on:
SQL Server ...
2
votes
1
answer
3k
views
Intentionally recursive instead of insert trigger does not want to nest
I have been struggling to get an instead of trigger to recursively call itself.
The idea is that when a row gets inserted into my table the trigger is placed on, based upon certain conditions ...
8
votes
1
answer
6k
views
Recursive CTE performance
Need help with recursive CTE performance. Below CTE is running very slow as it is trying to pull heirarchical
data recusively. Table is big with every root id having upto 3 recursive itemid. There ...