[DB-SIG] SQL query help

chris@onca.catsden.net chris@onca.catsden.net
Wed, 7 Mar 2001 12:02:28 -0800 (PST)


On Wed, 7 Mar 2001, Ryan Weisenberger wrote:

> Does anyone know how to get at tables with spaces in the name?  The
> Microsoft SQL Server 2000 demo database is loaded with tables with names
> like "Order Details".
>
> I've tried a few combinations:
> c.execute("select * from order details")
> c.execute("select * from order-details")
> c.execute("select * from order_details")
> c.execute("select * from 'order details'")
> c.execute("select * from order%20details")
>
> All of these return a syntax error from the SQL parser.
>
> Does anyone know the correct syntax for this?

I've no experiences with MS products, but PostGres allows you to quite
identifier names with double quotes. (Single quotes are for strings)

So, try something like

select * from "order details"


   ("`-/")_.-'"``-._        Ch'marr, a.k.a.
    . . `; -._    )-;-,_`)  Chris Cogdon <chmarr@furry.org.au>
   (v_,)'  _  )`-.\  ``-'
  _.- _..-_/ / ((.'       FC1.3: FFH3cmA+>++C++D++H++M++P++R++T+++WZ++Sm++
((,.-'   ((,/   fL               RLCT acl+++d++e+f+++h++i++++jp-sm++