Merge two cursors
Merge two cursors
(OP)
Dear All,
I have two cursors like the ones below.tt1 and tt2
I want to insert them into the one SQL table(Items) using index.
Item Table
Could someone please guide me on how to do this?
thank you
I have two cursors like the ones below.tt1 and tt2
CODE -->
Index Col01 Col02 ... col164 1 Data01 Data03 ......... 2 Data02 Data04 .........
CODE -->
Index Col165 Col166 ... col324 1 Data01 Data03 ......... 2 Data02 Data04 .........
I want to insert them into the one SQL table(Items) using index.
Item Table
CODE -->
Id Col03 Col04 ………. ………. ………. Col324 1 Data01 Data03 …….. …….. …….. ……. 2 Data02 Data04 …….. …….. …….. ……..
Could someone please guide me on how to do this?
thank you
RE: Merge two cursors
CODE -->
I say "in theory" because you are trying to create a cursor with 324 fields, but a VFP table has a limit of 255 fields.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Merge two cursors
Well, this would be one way to do it:
CODE
Use tt2.dbf in 0 order index Select 0 Use tt1.dbf Set Relation to index into tt2 * maybe here set a breakpoint and browse to see you get the data row alignment correct. h = SQLStringConnect(...) && or however you connect to SQL Server Local lcSQL Text to lcSQL NoShow Insert Into dbo.Item (id, col03,col04,...,...,col324) values (?tt1.col3, =tt1.col4,...,...,?tt2.col324) EndText Select tt1 SQLPrepare(h,lcSQL) SCAN SQLEXEC(h) ENDSCAN
Chriss
RE: Merge two cursors
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Merge two cursors
We don't know how this table is designed, if it exists, the row size seems to not violate SQL Server limitations, but capabilities of SQL servers are higher in almost any aspect as they need to be.
Chriss