Skip to content

Syntax for "WITH RECURSIVE" is slightly different in SQL Server #1188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2024

Conversation

aidanharan
Copy link
Contributor

In SQL Server, with recursive syntax is just "WITH" rather than "WITH RECURSIVE" as with other DBs.

See: https://www.sqlservertutorial.net/sql-server-basics/sql-server-recursive-cte/

Fixes ActiveRecord::WithTest#test_with_recursive:

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/actions/runs/9213138372/job/25346328785

 1) Error:
ActiveRecord::WithTest#test_with_recursive:
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near 'top_companies_and_children'.

@aidanharan aidanharan changed the title Syntax for with recursive slightly different in SQL Server Syntax for "WITH RECURSIVE" slightly different in SQL Server May 24, 2024
@aidanharan aidanharan changed the title Syntax for "WITH RECURSIVE" slightly different in SQL Server Syntax for "WITH RECURSIVE" is slightly different in SQL Server May 24, 2024
@aidanharan aidanharan marked this pull request as ready for review May 24, 2024 19:53
@aidanharan aidanharan merged commit f73591f into main May 24, 2024
2 of 8 checks passed
@aidanharan aidanharan deleted the with-recursive branch May 24, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant