[ACCEPTED]-Query a table that has spaces in its name-tablename

Accepted answer
Score: 52

Surround the spaced out item with square 2 brackets:

[Common station]

Then slap the guy who designed 1 the database.

Score: 6

SELECT * FROM [My Crazy Table With Spaces and Other Chars!]

Use brackets to "quote" table and field 1 names.

Score: 4
  cmdnon.CommandText = "INSERT INTO '[Common station]' ( S1Flow, S2Flow, S3Flow, S4Flow) VALUES (9999,999, 999, 999)";
    //Once the above line works replace it with cmdnon.CommandText= "INSERT INTO Gas Flow Rates ( S1Flow, S2Flow, S3Flow, S4Flow) VALUES (9999,999, 999, 999)"

0

Score: 2

Late to the party I know, but have just 7 solved my own issue here... Playing in access 6 2007 using ODBC connection to an SQL Db.

Table 5 name is Employee_Appointment Extra Detail 4 Custom Syntax to select is as follows SQlRecordSet.Open 3 "Select * from [Employee].[Appointment Extra 2 Detail Custom]", Conn, adOpenStatic, adLockOptimistic

Hope 1 this saves someone else a few hours of playing!

More Related questions