|
Posted by Dikkie Dik on 10/01/06 21:13
> I have a problem writing PHP ODBC scripts that suit both MySQL and
> PostgreSQL. So far, the following syntaxes seem to apply to each
> database (this is an 'insert' example; the same differences apply to
> 'select commands):
>
> MySQL: INSERT INTO MyTable (col1, col2) VALUES ("value1","value2")
> PGSQL: INSERT INTO "MyTable" (col1, col2) VALUES ('value1','value2')
You can run the second line in MySQL also - when you are running the
server in ANSI mode.
> I'd like to have a single syntax for both databases. Is this possible?
I think the SQL standard version of the above statements is:
INSERT INTO MyTable(col1, col2) VALUES ('value1','value2')
(Actually, the SQL version is without the columns, but most SQL
databases support the column list)
It would surprise me if PostGress would not understand this statement.
Best regards
[Back to original message]
|