>Not really sure where to put this one:
>
>I have a batch that I did as a stored procedure in SQL2000. It takes 0:02:40 to run as an SP. As a query through the Analyzer it takes all of 3 seconds and returning 1700 rows. I figured that doing it as a batch from my Fox app would be the way to go (big time difference there). When I run it as batch using SQLEXEC(), SQLEXEC() returns 1. (No errors) But I don't get any result sets.
>
>This is what I use and get a 1 back from SQLEXEC():
>
>
>? SQLEXEC(x,"Begin " + CHR(13) + CHR(10) + p + CHR(13) + CHR(10) + " END" ,'TEST')
>
>
>Within this there is the following line for parameters:
>
SET @FiscalYear = ?FY
>SET @Accounts = ?Accounts
>set @SWDNs = ?SWDN
>set @PrimaryDocs = ?PDOCs
>SET @glcs = ?GLC
>SET @Sites = ?Sites
>
>Using the Profiler, it LOOKS like Fox translates it to use sp_executesql and for the most part correctly identifies variable type and length.
>
>How do I need to put this into SQLEXEC() to get a result set back (It's supposed to return 2 of 'em) ?
>
>
>TIA,
>Richard
text to m.lcSQLBatch noshow
-- SQL commands as they appear in analyzer --
endtext
SQLExec(m.lnHandle, m.lcSQLBatch, 'test')
However I would check why there is such a difference between SP and batch.
Cetin