Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem calling SP in SQL 2000 from VFP via SPT
Message
De
03/08/2001 08:37:33
 
 
À
03/08/2001 03:45:21
Martin Van Krieken
Capgemini Nederland Bv
Utrecht, Pays-Bas
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00536342
Message ID:
00539325
Vues:
20
Nothing jumps out at me as to the cause of the problems you're reporting.
>lnResult = SqlExec(lnBlDbHandle, 'Exec sp_UpdateBulkLoad @tiBedrijfId=' +
>                    Transform(.piBedrijfId) + ",@tcLangUp='NL'")
I see nothing wrong with the way that you're calling the stored procedure.
>Declare c_Bulkload Cursor Local For
>Select r.LevensNr,d.iBlDierId,d.lDelete,d.pk_Dier,d.Naam,d.Roepnaam,
>d.lBlMale,d.GeboorteDatum,d.DierSoort,d.Eigenaar,d.Vader,d.Moeder,
>d.EtMoeder,s.pk_Source As iSource
>From Dier d
>Left Join Rund r On r.iBlDierId = d.iBlDierId
>Left Join AvWSql.dbo.Source s On s.cApp = @tcSourceApp And s.cSource = d.cSource
>Where d.pk_Bedrijf = @tiBedrijfId
This cursor is SENSITIVE, meaning that any changes to the data by other connections will be reflected in the cursor.
>While @@Fetch_Status = 0
You're only checking @@FETCH_STATUS for zero (0) which is a successful fetch of a row. Since the cursor is sensitive, you might want to check for a value of -2. A -2 will be returned in @@FETCH_STATUS when the two to be retrieved is no longer in the table.
>		Select pk_Dieren
>		From AvWSql.dbo.Dieren
>		Where pk_Dieren = @pk_Dier
>		And fk_Bedrijf = @tiBedrijfId
>		
>		Select @liError = @@Error, @liRowCount = @@RowCount
>		If @liError = 0 And @liRowCount = 0
I also notice that you have a SELECT query within the stored procedure. A stored procedure is capable of returning multiple result sets. I wonder if you're seeing ODBC trip on this. Put SET NOCOUNT ON at the top of the stored procedure. Also, the better practice would be to use IF EXISTS()
IF EXISTS (Select pk_Dieren
           From AvWSql.dbo.Dieren
           Where pk_Dieren = @pk_Dier
           And fk_Bedrijf = @tiBedrijfId)
instead of running the query and checking @@ROWCOUNT. If you do need the number of rows, this is the perferred syntax:
IF (Select COUNT(pk_Dieren)
    From AvWSql.dbo.Dieren
    Where pk_Dieren = @pk_Dier
    And fk_Bedrijf = @tiBedrijfId) = the_value
I bet your problem will be fixed by putting SET NOCOUNT ON at the top of the stored procedure. Try that and let us know.

-Mike

P.S. Als je een vraag op een Engelse talig forum stelt, kun je beter ook Engels talige queries inzenden.
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform