I get this error message:
The conversion of a nvarchar data type to a datetime
when I try to bind a MySQL datetime
variable to a smalldatetime
variable in SQL Server statement. The code looks like:
$s = $dbcnx->prepare("SELECT MAX(attr_81577_) AS max_date FROM object_70969_");
$s->execute();
$r = $s->fetch(PDO::FETCH_ASSOC);
$max_date = $r[max_date]; // we got the maximum date from MySQL table
$s = $dbms->prepare("SELECT * FROM orgs WHERE update_date >= :max_date"); // Now we want to filter SQL Server table based on $max_date value
$s->bindParam(':max_date', $max_date);
$s->execute();
What is wrong with that and what can I do?