SQLProvider icon indicating copy to clipboard operation
SQLProvider copied to clipboard

Support table names with spaces

Open ieviev opened this issue 3 years ago • 2 comments
trafficstars

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 avatar Feb 22 '22 16:02 ieviev

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 avatar Feb 22 '22 16:02 ieviev

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?

ieviev avatar Feb 22 '22 16:02 ieviev