You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Dave Hodson <da...@messagecast.net> on 2003/12/23 01:32:00 UTC

Stored Procedures/SQL Server on RC5

Using the update-procedure call in RC5 produces SQL that seems to be
invalid on SQL Server.

For example, RC5 creates the following SQL statement to call an update
procedure

declare @P1 int
set @P1=100011
exec sp_executesql N'{ call prc_test(@P1 OUTPUT,@P2) }', 
N'@P1 int OUTPUT ,@P2 int ', @P1 output, 0
select @P1

Running this code produces the following error message:

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '{'.

If I change the above sql statement to this, it works:

declare @P1 int
set @P1=100011
exec sp_executesql N' exec prc_partnernew_inuse_internal @P1 OUTPUT,@P2
', 
N'@P1 int OUTPUT ,@P2 int ', @P1 output, 0
select @P1

The change is all in one line:
>From this:
exec sp_executesql N'{ call prc_test(@P1 OUTPUT,@P2) }', 

To this:
exec sp_executesql N' exec prc_test @P1 OUTPUT,@P2 ', 

(removing the braces and parens and changing "call" to "exec")
According the SQL Server 2k docs, "call" is used to execute a user
defined function.

Has anyone seen similar experiences or gotten this to work? Looking
through the code, it seems like an easy change, but I'm guessing doing
things like using "exec" instead of "call" will break other DB
platforms(??)

Dave