Skip to main content

All Questions

1 vote
1 answer
830 views

TSQL - Recursively select date between 2 given dates

I have table in my db called Tasks. Every record in that table has 2 fields: StartDate, EndDate I need to create recursive stored procedure that will send mails in middle of those dates. For example: ...
Misiu's user avatar
  • 4,939
1 vote
1 answer
332 views

TSQL recursion - max recursion error with duplitace values in table

Related question: TSQL check if specific rows sequence exists I'm asking second question about recursion, because this time it is different thing (in my opinion) so please don't delete it. I have ...
Misiu's user avatar
  • 4,939
2 votes
1 answer
221 views

Getting comma separated month for a given from month and to month using recursive CTE

We have requirement where 2 months and 2 years are provided as input. And the result should provide a comma separated month-year all the months between the from month-year and to month-year. Say, we ...
suryakiran's user avatar
  • 1,994
4 votes
1 answer
1k views

Exiting from recursive common table expression once the result set contains some value

Given the following table: create table TreeNode ( ID int not null primary key, ParentID int null foreign key references TreeNode (ID) ) How could I write a common table expression to start at ...
Daniel's user avatar
  • 47.9k
0 votes
3 answers
240 views

Aggregate survey results recursively by manager

I have a StaffLookup table which looks like this. UserSrn | UserName | ManagerSrn =============================== ABC1 | Jerome | NULL ABC2 | Joe | ABC1 ABC3 | Paul | ABC2 ABC4 ...
Ian Roke's user avatar
  • 1,784