RE: [PHP-DB] MSSQL: Spaces in database name
| From: | Robert D. Young | Date: | Thu, 09 Aug 2001 03:59:51 +0000 |
| Subject: | RE: [PHP-DB] MSSQL: Spaces in database name | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11154@lists.php.net to get a copy of this message | ||
Understood. Notice that almost all of the MS databases and tables
(predefined and samples) have *no* space in them. I'd long ago forgotten the
ODBC/SQL syntax (last time I used it was in 95), thanks for the reminder.
- Robert
(who likes to use human readable names wherever possible)
-----Original Message-----
From: Graeme Merrall [mailto:graeme@inetix.com.au]
Sent: Wednesday, August 08, 2001 8:19 PM
To: Robert D. Young
Cc: 'Beau Lebens'; 'php-db@lists.php.net'
Subject: RE: [PHP-DB] MSSQL: Spaces in database name
Quoting "Robert D. Young" <Robert@AbilitySys.com>:
> That did it! Using:
>
> <... stuff >
> $dbname = "[Test Database]";
> <... more stuff >
> mssql_select_db($dbname);
>
> worked perfectly. Again, Thanks!
This is standard Microsoft (and maybe ODBC?) syntax. Using square brackets
will
work on most things including table names and field names with spaces in
them.
This will work fine
SELECT [table space].[field space] FROM [table space]
It doesn't mean that you should go around putting spaces in your database
objects. That's never a good idea :)
Cheers,
Graeme