473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Impoting Multiple Flat Files to Multiple Tables

I am moving data from Oracle to MS SQL 2000.

I have been given the Oracle table structures and about 130 CVS files to populate these structures, 1 file per table. I have converted the table structures to a MS SQL format and successfully created the tables but I am having problems creating the DTS package.

I have set the package with Global Variables that allow me to specify which file to send to the given tables (see batch call below). The table names match the file names.

I am running into problems specifying the transformation for the different columns in each table.

Is there something I can put in an ActiveX Script that would let me pull the column names out of the file being processed and specify these column names in my package? The flat files have a header row.

Is there a better way to do this?
-Dave

--Batch call--
Expand|Select|Wrap|Line Numbers
  1. REM SOURCE:http://www.databasejournal.com/features/mssql/article.php/3325731
  2. dir D:\TEST_Legacy\Testi\*.csv /b > D:\TEST_Legacy\Testi\Dirlist.txt
  3. IF ERRORLEVEL == 1 GOTO BAD
  4.  
  5. REM Execute DTS package for every file name in the Dirlist.txt
  6. for /f "tokens=1,2,3" %%i in (D:\TEST_Legacy\Testi\Dirlist.txt) do (
  7.     REM Get table name
  8.     for /F "tokens=1 delims=." %%A in ('echo %%i') do (
  9.         DTSRun /N "Import_Test" /V "{064D46BB-776D-4650-9EE8-CB42833B0648}" /F "D:\TEST_Legacy\Testi\Import_Mult_Tbl_TESTi.dts" /L "D:\MyImport\ImportError.txt" /A "Database":"8"="TESTi" /A "File":"8"="D:\TEST_Legacy\Testi\%%i" /A "Sever":"8"="TEST_SERV" /A "Table":"8"="[dbo].%%A" /W "-1" 
  10.         IF ERRORLEVEL == 1 GOTO BAD
  11.     )
  12. )
  13.  
  14. REM Rename all the files with "old" as suffix
  15. ren c:\myimport\*.csv *.csvold
  16. GOTO END
  17.  
  18. :BAD
  19. ECHO Error
  20.  
  21. :END
  22. PAUSE
  23.  
Aug 9 '07 #1
0 1363

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm...
8
by: DB2 Novice | last post by:
I am trying to use DB2 Control Centre (version 8.2) to load one flat file into multiple tables. However, I don't see the options in Control Centre that allows that. Anyone knows how to do this?...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
3
by: Joe | last post by:
Hi I have a dataset with 2 tables and Relations What is the best way to flatten the 2 files to a new table or xml or file I can loop thru table1 and get the childrows or I can do an Xpath on...
4
by: HLCruz via AccessMonster.com | last post by:
I am working with a database that has client information separated in to 4 related tables - tFolder, tAddress, tEmail, tPhone number. In addition there are related tables tGifts and tCalls. The...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
1
by: hkhella | last post by:
I receive several flat files daily that need to be improted into my Access Database. Each file record starts with a specific letter or group of letters, the following lines or rows in the flat file...
7
by: Pete | last post by:
I need to import multiple tab delimited files for which I do not have the formats. All files have column headers in the the line. The files must be dynamic. The only common value is that the...
3
by: Tim | last post by:
Hi Folks, I'm used to a UNLOAD command that allows me to dump to a named flat file the results of any SELECT statement. Hence one can build a single SQL file which contains multiple SQL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.