[KLUG Members] Database import help

Adam Williams members@kalamazoolinux.org
27 Feb 2003 18:45:28 -0500


>Not sure if this can be done programmatically or not
>but here goes the question...
>I have a text file that has Student Test Scores in it
>and I need to Import them into a SQL Database. The
>problem is the text file is a comma delimited file in
>a different format than the table the information
>needs to be imported to. Also the primary key is
>different as well (file has the student ID and the
>table has an internal linking number not the ID). 
>So not knowing any programming (currently) is there a
>way of looking at a seperate table in the database to
>get the internal link field to come over and then
>create a new txt file or table in the database that
>has the new internal link number and the tests scores
>so that I can then import into the proper table.
>I can always retype the text file... but that will be
>a pain for 5000 records.

You need to locate the table in the schema that contains both student id
and the linking number.

Then load the file into a temporary table.  Insert the data into the
table where you need to from a join of the temporary table and the table
containing both the student id and the linking number.