Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting SingleUser
Message
De
20/03/2002 12:34:43
 
 
À
16/03/2002 13:32:59
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Maintenance bases de données
Divers
Thread ID:
00633529
Message ID:
00635070
Vues:
23
Michael,

sorry for the delay in responding. Had a baby last week so it's been a little crazy.

I was able to get this to work, but still missing a way to check the result set from a batch with multiple commands. I had to change the syntax a bit to work (by adding BIT, pun intended)

SQLExec(chnd, "DELCARE @rc BIT; EXECUTE @rc = sp_dboption @database, 'single user', 'TRUE'; SELECT @rc")

This is working properly, sqlexec is returning 1 and I can confirm that the database is exclusive. However, i can't see the result set. I would have thought that changing the syntax to

SQLExec(chnd, "DELCARE @rc BIT; EXECUTE @rc = sp_dboption @database, 'single user', 'TRUE'; SELECT @rc", 'csrTest')

and specifying the name 'csrTest' for the result set would have given me the results for the select statement. I'd not only like to know how to do this for other batches I may create, but my concern is that somehow the command to set single user may fail but yet still return 1 to SQLEXEC. That may not be possible. However, I'd like to double check the result set in any case. Am I just using the wrong syntax in my SQLEXEC?

Thanks

Jim


>There used to be an issue where you couldn't catch the return value from a stored proc. I don't remember if it was a VFP or ODBC issue.
>
>You can still get it, if you really need it. You just have to go through some indirection.
>
>Remember that when you use SPT to send a query to SQL Server, you're actually submitting a batch and a batch can have multiple command in it. So using something like this will return the return value but has a result set.
>
>SQLExec(chnd, "DELCARE @rc; EXECUTE @rc = sp_dboption @database, 'single user', 'TRUE'; SELECT @rc")
>
>-Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform