Don't i agree! I didn't create this database.   and I don't use spaces for
anything.  that is always good pracice, but since these folks had...here is
what i found.

The [ ] notation,  works fine on tables,  i.e.  [BUSINESS AREA]  but when
you have a column with a space then use this notation [BUSINESS_AREA].
ODBC will allow for the " "(space) to "_"(underscore) translation.  Now, if
you are doing joins...make sure only to bracket the table/column that needs
bracketing i.e. REQ.[BUSINESS_AREA].  and don't use the _ if it's a table,
i.e.  [BUSINESS AREA].[BUSINESS_AREA].

Hope this helps someone else.
Jeff


                                                                                       
                             
                    "Ryan Jameson                                                      
                             
                    (USA)"               To:     <[EMAIL PROTECTED]>                
                             
                    <RJameson@usa.       cc:                                           
                             
                    ibs.org>             Subject:     RE: [PHP-DB] tables/columns with 
spaces                       
                                                                                       
                             
                    05/10/2002                                                         
                             
                    11:46 AM                                                           
                             
                                                                                       
                             
                                                                                       
                             




[] is the correct notation for both tables and columns. I don't ever
recommend using spaces in anything, file names, tablenames, or anything
else that will bite you later. But that is the correct syntax, so there may
be another problem. Maybe BUSINESS AREA is numeric?

<>< Ryan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 6:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] tables/columns with spaces


Someone, in their infinite wisdom, named some, not all of course,  tables
and columns with spaces, i.e. BUSINESS AREA in a SQL server database that i
am working with.  You can run lots of queries that return fine, but when I
run a query such as "select * from REQ where BUSINESS AREA = '$var', i get
an error. Which, to me is completely understandable.  I have tried using
the [BUSINESS AREA] notation, which will work on tables named with spaces,
but not field names.
I want to simply rename, and make the others adapt their code to conform.
But i wanted to try to solve this first.
Any ideas...?

Thanks,
Jeff


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to