dbTalk Databases Forums  

Importing data into multiple table using 1 excel sheet

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Importing data into multiple table using 1 excel sheet in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BenjaminHoo
 
Posts: n/a

Default Importing data into multiple table using 1 excel sheet - 02-13-2006 , 06:40 AM






Greetings,

I am a newbie in using DTS.

I would like to load data from 1 single excel sheet[tab] into multiple
fields of different tables in database.


EXAMPLE:
DATABASE TABLE


Table 1: COURSE
course_code
course_name
faculty_code(FK)

Table2: FACULTY
faculty_code(PK)
faculty_name
faculty_add
faculty_postcode
faculty_city
faculty_state
faculty_country



EXCEL SHEET
(In 1 *.xls file i have 1 sheet containing the "combined" field of the 2
table shown as below
course_code course_name faculty_code faculty_name faculty_add faculty_postcode faculty_city faculty_state faculty_country



I am a student, ive tried to load data *. xls to single table(eg: course
only) using the DTS function without any problem.
However, when i combined the table in excel(shown above) to load data, i
encounter an error saying:

"Error at Destination for Row number 1. Errors encountered so far in this
task: 1."

My lecturer said it is possible to load data into different field from
different table using only 1 worksheet[tab] from excel file(as shown above)
and require me to show it to her as a graded assignment.

She emphasize on using just "1 sheet", not using multiple sheet[tap] to load
data into the field of different table. (which is connected thru the FK)

I need to show it soon. Can any experts out there provide me some guideline
how it is done?
Your help is very much appreciated!

Thanks in advance!

Reply With Quote
  #2  
Old   
Kris
 
Posts: n/a

Default Re: Importing data into multiple table using 1 excel sheet - 02-13-2006 , 09:19 AM






Hi Benjamin,

Create a DTS package with the steps below

Load the data into a temp table
Copy the required field values into the specific table by using SQL
queries
Drop the temp table.

Cheers,
Kris


Reply With Quote
  #3  
Old   
BenjaminHoo
 
Posts: n/a

Default Re: Importing data into multiple table using 1 excel sheet - 02-14-2006 , 04:05 AM



Hi Kris,

I appreciate your help and reply.
Your method can works but is there such thing as "mapping table" ?
because its not what she is looking for....

Regards,
ben


"Kris" wrote:

Quote:
Hi Benjamin,

Create a DTS package with the steps below

Load the data into a temp table
Copy the required field values into the specific table by using SQL
queries
Drop the temp table.

Cheers,
Kris



Reply With Quote
  #4  
Old   
Kris
 
Posts: n/a

Default Re: Importing data into multiple table using 1 excel sheet - 02-14-2006 , 09:23 AM



Hi Ben,

Use VBScript to load the data. And run it as DTS package.

Cheers,
Kris


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.