语法错误或访问冲突,SQL状态37000. MSSQL虽然来自PHP的ODBC

I'm trying to execute a stored procedure in a ms sql database using the following php:

$query = "{CALL dbo.storedProc('functionName', $date, 'id";
$resultSet = odbc_prepare($connection, $query);
odbc_execute($resultSet, array());
odbc_result_all($resultSet);

The same stored procedure works fine for a different function, and the results are selected by date like so ($date is @Searchstr):

(EventStart >= @Searchstr AND EventStart < DATEADD(DD,1,@Searchstr))

However, when I run the code, it errors without giving any specific hints as to what's causing the error. When the query is run in management studio, the results are returned correctly.

SQL error: [Microsoft][ODBC SQL Server Driver]Syntax error or access violation, SQL state 37000 in SQLPrepare in ...

What's causing the query to error? Could it be an ODBC bug?

Thanks in advance, Will

The query seems to be missing ')} at the end.