fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
564 stars 144 forks source link

Support table names with spaces #759

Closed ieviev closed 1 year ago

ieviev commented 2 years ago

Some applications have table names with spaces
using MSSQLSERVER provider

image

querying tables without spaces works, all tables with spaces in the name fail

image

ieviev commented 2 years ago

problem seems to be in the quotes surrounding the table

SELECT  FROM [dbo].["Application Object Metadata"] as [x] WHERE (([x].[Object ID] > @param1)) -- params @param1 - 50000;
ieviev commented 2 years ago

turns out the first identifier allows quotes but the one after FROM does not,

generated sql:

SELECT ["Application Object Metadata"].[Object ID] as 'Object ID' FROM [dbo].["Application Object Metadata"] as ["Application Object Metadata"]  -- params

tested correct sql

SELECT ["Application Object Metadata"].[Object ID] as 'Object ID' FROM [dbo].[Application Object Metadata] as ["Application Object Metadata"]  -- params

where is this FROM expression in code?