From: "Martin J. Evans" <[EMAIL PROTECTED]>
> I don't use ADO but I do use ODBC. SQL Server normally batches the
> statements in a procedure so in ODBC terms for your procedure you have
> to:
> 
> execute
> fetchall
> SQLMoreResults # moves to the update
> rowcount - to get row update count
> SQLMoreResults - # moves to the second select
> fetchall
> SQLMoreResult - returns SQL_NO_DATA
> 
> DBD::ODBC used to have a lot of problems with procedures like this
> including hitting an issue in the MS SQL Server driver which would
> return invalid cursor state when prepare/execute was used but worked
> fine with SQLExecDirect.
> ...

> On 01-Mar-2005 David N Murray wrote:
> > create procedure p
> >       @p int
> > as
> >     select top 10 c1, c2
> >       into #tmp
> >       from t
> >       where c3 = @p
> >     update t
> >       set c4 = 1
> >       from t, #tmp t2
> >       where t.c1 = t2.c1
> >     select c1, c2
> >       from #tmp
> >       order by c2, c1
> > go

Try to add 
        SET NOCOUNT ON
on top of the stored procedure. That should prevent the select into 
and update statements from getting in the way.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

Reply via email to