Hi all, In java-jdbc, I can easily run the following SQL (NOTE the double quotes around columns and table names)
Select
cus."customer_id" ,
cus."organisation_or_person" ,
cus."organisation_name" ,
cus."first_name" ,
cus."last_name" ,
cus."date_became_customer" ,
cus."other_customer_details"
From
"Contact_Management"."dbo"."Customers" cus
But the same query in PHP errors out saying invalid syntax
"Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'customer_id'. (severity 15) "
But If remove all the double quotes, the query works fine and no errors.
The query is ported from a java application so I would like to keep the double quotes and the SQL as it is. Any alternative solutions?
Thank you Nilesh
Volkerk -- Solution (SET QUOTED_IDENTIFIER ON)
I did the following
$sql = <<<EOD
Select
cus."customer_id" ,
cus."organisation_or_person" ,
cus."organisation_name" ,
cus."first_name" ,
cus."last_name" ,
cus."date_became_customer" ,
cus."other_customer_details"
From
"Contact_Management"."dbo"."Customers" cus
EOD;
$db->Execute('SET QUOTED_IDENTIFIER ON');
$rs = $db->Execute($sql);
And it worked perfect
Thank you so much..