Skip to content
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

Incorrect syntax near '(' sqlsrv #1588

Open
ciaksoy opened this issue Sep 20, 2024 · 0 comments
Open

Incorrect syntax near '(' sqlsrv #1588

ciaksoy opened this issue Sep 20, 2024 · 0 comments
Labels

Comments

@ciaksoy
Copy link

ciaksoy commented Sep 20, 2024

Versions:

  • ide-helper Version: 3.1.0
  • Laravel Version: 11.23.5
  • PHP Version: 8.3.11
  • Sqlsrv Version: 16.0.1000.6 (X64)

Description:

When I use php artisan ide-helper:models, the following query gives Incorrect syntax near ‘(’ error

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '('.
select 
  fk.name as name, 
  string_agg(lc.name, ',') within group (
    order by 
      fkc.constraint_column_id
  ) as columns, 
  fs.name as foreign_schema, 
  ft.name as foreign_table, 
  string_agg(fc.name, ',') within group (
    order by 
      fkc.constraint_column_id
  ) as foreign_columns, 
  fk.update_referential_action_desc as on_update, 
  fk.delete_referential_action_desc as on_delete 
from 
  sys.foreign_keys as fk 
  join sys.foreign_key_columns as fkc on fkc.constraint_object_id = fk.object_id 
  join sys.tables as lt on lt.object_id = fk.parent_object_id 
  join sys.schemas as ls on lt.schema_id = ls.schema_id 
  join sys.columns as lc on fkc.parent_object_id = lc.object_id 
  and fkc.parent_column_id = lc.column_id 
  join sys.tables as ft on ft.object_id = fk.referenced_object_id 
  join sys.schemas as fs on ft.schema_id = fs.schema_id 
  join sys.columns as fc on fkc.referenced_object_id = fc.object_id 
  and fkc.referenced_column_id = fc.column_id 
where 
  lt.name = N 'TABLE_NAME'
  and ls.name = schema_name()
group by 
  fk.name, 
  fs.name, 
  ft.name, 
  fk.update_referential_action_desc, 
  fk.delete_referential_action_desc
@ciaksoy ciaksoy added the bug label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant