Hi!
To reduce network overload by constant calling of SQL Server for each insert command for each integer value, you can insert them all at once from the local cursor:
local strSQL
strSQL = ""
select IDValues
scan all
strSQL = strSQL + "INSERT INTO #TempTable VALUES("+allt(str(IDValues.Key))+")"+ chr(13) + chr(10)
endscan
nResult = SQLEXEC(cursorgetprop("ConnectHandle","SomeViewAlias),strSQL)
Well, if you work using SQL Pass-Through, you probably already have connection handle...
Note that you can run any set of T-SQL command from VFP using SQLEXEC() command.
HTH.
>Thanks...that worked out well. Most of the time, it's the GROUP BY in our app that's variable at runtime.
>
>
>I have a follow-up question. Our apps allows users to report off of (potentially) hundreds of selections that are picked from a MOVER-style form. We need to get the list of integer keys for each user-selection back into SQL Server, because the eventually query involves each of these integer keys.
>
>What I'm doing is creating a temp table in SQL, then doing an INSERT for the integer key for each user-selection (it's a list of accounts and a list of items). Then I have a stored proc that runs against a historical transaction file and the list of integer keys from the user selections.
>
>This works great...when someone has a fast connection to a corporate database. What I don't know is how that would work if someone is working off of, say, a fractional T1.
>
>What is the best (i.e. fastest) way to get a potentially long list of user selections to the back-end for querying? I haven't tried an updatable cursor yet, but have wondered if that would be faster.
>
>Thanks in advance,
>Kevin
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.