Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sqlexec -- determing success
Message
De
15/02/2000 14:25:28
 
 
À
15/02/2000 12:50:44
Oleg Khvalin
The Sutherland Group Ltd
Rochester, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00332223
Message ID:
00332389
Vues:
11
>>>I'm being stupid. I can use a parameterized procedure... just pass it the actual data.... So I don't have to create a new procedure each time. I may not be an expert with TSQL now. (I've not been doing it very long.) But I will be ...
>>
>>except that according to the documentation -- SQLEXEC does not return the value return by sQl statement. It returns -1 for connect error , 0 if it is still executing, and 1 if successful. I'm still writing a procedure that returns @@rowcount, just in case the documentations is wrong (as sometimes happens with Microsoft.._
>Gar,
>SQLEXEC can also return the cursor, so the very last statement of your stored proc will be SELECT count(*) ..... or like
>Oleg
According to Microsoft documentation the SQLEXEC can also fetch an output parameter from the SPT. (This is documented not under the SQLEXEC topic, but only under The SQL passthrough and stored procedures topic -- usual user friend MS indexing). So I can just set an output parameter to the @@rowcount variable and I should be able to do this without a second SELECT statement. (I'm trying to avoid doubling the number of selects I execute inside a loop.)

The only problem is that something is wrong with my syntax. I have the following stored procedure which compiles without error messages:
create procedure sp_sql_passthrough  @sql_string Varchar(255),
@no_of_rows INT OUTPUT
AS
EXEC(@sql_string)
SELECT @no_of_rows=@@rowcount
For test purposes at the VFP command line I create a variable ioutput, which I initialize to -200.

I then execute the following
ln_success=sqlexec(vn_conn_handle,[execute sp_sql_passthrough 'update tb set c1="a"',?ioutput])
The update command works fine executed directly in the query analyizer or passed along directly (without wrapping in the stored procedure).

ln_success is set to 1 -- meaning it is successful. (But no sqlresults table is created.) The ioutput variable remains unaltered. I strongly suspect this is a simple syntax error on my part (but VFP or MSSQL or both - I do not know)...

Thanks

Gar
Thanks

Gar W. Lipow
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform