|
Archives of the TeradataForumMessage Posted: Wed, 23 Oct 2002 @ 14:16:05 GMT
If you have the Teradata ODBC driver, this would probably be fairly easy and effective using VB. First, create an ODBC Datasource for your Teradata system. Then In VB, create a new standard project, add a reference to DAO 3.6 and put a file list control (default name is file1) on the primary form. The program logic must (this is not the actual VB you need but is close): - Create a connection to Teradata Set teraworkspace = CreateWorkspace("TERAODBC","dummy","",dbuseodbc) Set teradb = teraworkspace.OpenDatabase("TERAODBC", dbDriveRPrompt, , ("ODBC;DSN=TERAODBC;)) - Set the properties on the file list box to hit the directory containing the files you want. file1.path = "x:\directory" - Index through the file list box, picking off file names: for i = 0 to (file1.listcount - 1) filename = file1.list(i)) - Use a pass-through query or connection.executesql to create a table. teradb.executesql "create table " & file1.list(i) & " (filetext as varchar(n))" 'something like that, anyway, must have a PK, though, or you won't be able to update/insert to the table. - After the table is created, open a recordset on it. terarecordset = teradb.openrecordset(file1.list(i)) - Read the data from the file and write it to the recordset terarecordset.addnew terarecordset.fields("filetext") = input(1) 'suitable for files < than your max varchar string length terarecordset.update - Close and repeat for next file. terarecordset.close set terarecordset = nothing close #1 next i This should be fairly easy for any reasonably experienced VB programmer. I'm guessing 30 lines of VB would cover it. It also seems to me that if your files are not small, you'll need to write chunks of text into the table, so you'll need a PK key for sequencing by line or chunk on the table. In any event, why do you want to do this?
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||