[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

SQL statement, using fields with spaces

Hello,

Although this sort of applies to Database Desktop, it's only because I plan on testing the SQL statements before using them in the SQL objects in Delphi.  What do I need to do in order to use a database that has fields that contain spaces.  I know that in MSAccess you could put brackets around then full name (eg [Customer Name]) but there doesn't appear to be a method for DD (and subsequently Delphi itself?).

Take, for example, the following simple SQL statement:

SELECT *
FROM 'c:\data\clients.db'
WHERE Customer Name = 'Bob'


Thanks
0
Sebastion
Asked:
Sebastion
  • 3
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
SELECT *
FROM 'c:\data\clients.db'
WHERE [Customer Name] = 'Bob'
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
or this:
SELECT *
FROM 'c:\data\clients.db'
WHERE "Customer Name" = 'Bob'
0
 
SebastionAuthor Commented:
Hmm, I've already tried the brackets, but I get the error "Invalid use of Keyword"

Using the double quotes returns nothing.  It feels like DD doesn't even validate the field, because if I were to instead use:

SELECT *
FROM 'c:\data\clients.db'
WHERE "Customerabdfsdf Name1esfrsfasf" = 'Bob'

It would return the exact same thing, nothing.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
this should work better:

SELECT c.*
FROM 'c:\data\clients.db'  c
WHERE c."Customer Name" = 'Bob'
0
 
SebastionAuthor Commented:
Yep, that's what I need.  Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now