>>>How do I return a cursor (temp table created in SQL Server stored procedure) back to VFP application?
>>
>>Finish your SP with:
>>
>>SELECT * from #TempTable
>>
>>
>>But why using temp table? Why not use table variable? When you use temp table you must care about uniqueness of its name.
>
>First, thank you for your message.
>
>1. Do I understand that whatever last "SELECT * ..." in my SQL Sproc will automatically return to calling VFP (without declaring any OUTPUT)?
To get a recordset from SP you must use SELECT ...., if you wanty to return a variable than you must add it as OUTPUT parameter and use it.
>
>2. I am using temp table that is what I read in one of the messages. What I do is convert an XML text passed to sproc to a temp table. Then this temp table is used in a SQL Select, in a JOIN. And I don't know what "table variable" is? Maybe you can teach me, please.
Table variable is just a local variable declared as table (WOW! what an explanation :-))
Table variable is kept in memory, temp tables are created in TempDB.
To declare table variable:
DECLARE @MyTable TABLE (Fld1 Int, Fld2 varchar(50) etc...)
Then you could use them as normal table with one condition everywhere you use them in JOIN you must give them alias, something like:
SELECT MyTempTable.*
FROM @MyTable MyTempTable
LEFT JOIN OtherTable ON ON MyTempTable.PK = OtherTable.Fk
SELECT OtherTable.*
FROM OtherTable
LEFT JOIN @MyTable MyTempTable ON OtherTable.Pk = MyTempTable.FK
>
>Thank you.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.