rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
968 stars 558 forks source link

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

Closed aidanharan closed 1 month ago

aidanharan commented 1 month ago

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'.