Before the SQL Server ODBC driver sends the command to the SQL Server, it restructures the ODBC call syntax to the SQL Server sp_opencursor command syntax. In the process of restructuring the command, the driver does not put a space after the name of the stored procedure. For example, calling this stored procedure causes the SQL Server ODBC driver to generate the following sp_cursoropen call.
Table Schema and Stored Procedure
create table testtable
(f1 integer)
go
create proc testproc
@p1 integer
as
select * from testtable where f1 = @p1
return 2
ODBC Call Syntax
Resulting Call to SQL Server 2000
exec sp_cursoropen @P1 output, N' EXEC @P1=testproc@P2? ', @P2 output, @P3 output, @P4 output, N'@P1 int OUTPUT,@P2 int', @P5 output, 1
Note that the second parameter and the name of the stored procedure do not have a space between them; this causes the syntax error.