At 8:51 -0500 1/15/05, Dave Merrill wrote:
???

SELECT 'asdf' . 'qwer'

...gives "Error Code : 1064, You have an error in your SQL syntax..."

I also can't find any reference to this use of periods in the docs.

Mostly we document how MySQL works, not all the things that you could possibly try that won't work. :-)

Periods are used for qualifying column and table names, e.g.,
tbl_name.col_name or db_name.tbl_name.col_name.


Have you tried it? Can you point me to something that says it ought to work? BTW, I'm trying this w mysql 4.1.7-nt-max on win2k, if it matters.


Also, part of my question was about standards, and it appears that I was being ignorant. Found this:

---------
The ANSI SQL concatenation operator is "||" used in Oracle, DB2 and others.
The + string concatenation operator in SQL Server is not portable to other
RDBMSs.
---------

That was here, in an excerpt from a book on SQL Server:
  http://www.informit.com/articles/article.asp?p=327992&seqNum=3

Looks like I was brought up in Microsoft's little corner of the world,
mistaking their "standards" for actual standards. Typical Micro$oft
intentional disruption.

But it appears that MySQL doesn't support "||" either, and neither does SQL
Server. So much for anyone other than customers caring about standards.
Writing platform agnostic sql seems much less likely than I'd guessed, even
on a very basic level.

If you want || to work as the concatenation operator rather than as logical OR, you can change the SQL mode:

mysql> SELECT 'a' || 'b';
+------------+
| 'a' || 'b' |
+------------+
|          0 |
+------------+
1 row in set (0.19 sec)

mysql> SET sql_mode='PIPES_AS_CONCAT';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT 'a' || 'b';
+------------+
| 'a' || 'b' |
+------------+
| ab         |
+------------+
1 row in set (0.14 sec)

There are a lot of ways you can make the server behave differently
by changing the SQL mode:

http://dev.mysql.com/doc/mysql/en/Server_SQL_mode.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to