Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-06 : 08:35:49
Dave writes "I suspect the solution to the folowing is obvious but here goes.

I have a stored procedure running on a server. The procedure takes the following parameters :

@SQLError - Output - int
@EventLog - Input - nvarchar
@FromDate - Input - datetime
@ToDate - Input - datetime
@Blocksize - Input - int
@Heartbeat - Input - int
@ArchiveSeqNo - Input - int

The procedure is specified to return 0 (success) or -1 (failure)

It is called from a C++ application on the client. The call sequence is as follows :

Call SQLBindParameter twice to bind the return value & the
first parameter to local variables
Execute the stored procedure by SQLExecDirect. In my case,
the command passed as a string in the second parameter to
SQLExecDirect looks as follows :

"{? = call spWI_ArchiveToLog(?, 'Application', '2004-03-01 00:00:00.000', '2005-01-30 23:59:59.999', 1, 5, 10)}"

The problem is that if the stored procedure returns before doing a database access(eg. select), the values set into my local variables are correct eg. if the stored procedure does

set @SQLError = 23
return (46)

the values 23 & 46 pop up in my local variables.

If however, the above code is obeyed after a database access, the local variables are unchanged. "

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-06 : 08:44:42
well for anything constructive to say we'd need to see some sproc code.
well at least i do...

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -