View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Lookup from a very heavy file

Here some code snippets and an example query.
It is not working code, but if needed I can post that later.

Dim rs As ADODB.Recordset
Dim TempTextConn As String

TempTextConn = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & _
"C:\TempTables\;" & _
"Extended Properties=Text;"

'query example :
'---------------
SELECT
P.PATIENT_ID,
P.READ_CODE,
P.TERM_TEXT,
P.ADDED_DATE,
P.ENTRY_ID
INTO ResultFile.txt IN
'C:\TempTables\'
'Text;FMT=Delimited'
FROM
all_auth.txt P INNER JOIN all_current_repeats.txt E ON
(P.ENTRY_ID = E.ENTRY_ID)

Set rs = New ADODB.Recordset

rs.Open Source:=strQuery, _
ActiveConnection:=TempTextConn, _
CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly, _
Options:=adCmdText


RBS


"Hari" wrote in message
oups.com...
RBS,

Thanks for your response. I have used SQL within SAS (and in a small
way in Oracle) but havent come across where Joins are done directly on
text files. I would like to learn this method of yours. When you say
text file, can it be done on CSV format files?

(Just to clue you in, as to how I was planning to approach this was by
doing an non-equi join to produce a table which doesnt have te lookup
values and secondly an equi join to produce a table which contains the
lookup values, then I was planning to stack these tables one below the
other with an additional column indicating as to what table they are
from.)

Regards,
HP
India