Mi Shan
Mi Shan

Reputation: 11

How to update multiple tables from excel file in SQL server

Hi I am new to SQL server. I need help to update two tables from excel file. Excel file includes all the data in 1 sheet and that data need to update on SQL server tables.

example data on the Excel file Employeename, Deparment

SQL tables are employer details and departments

I know how to add to the table but I want to know for the multiple tables

Upvotes: 1

Views: 648

Answers (2)

SHD
SHD

Reputation: 409

Use the following steps,

  1. Create a temporary table with the same structure as excel.
  2. Import data from excel to temp. table using SSIS package/Export/Import Wizard/ Just Copy & Paste
  3. Insert into department table by selecting distinct departments from temp. table.
  4. Insert into employee table by selecting employee details, department pk can be selected from department table by department name.
  5. Remove temporary table.

Upvotes: 1

Kapil
Kapil

Reputation: 987

Create and use a SSIS package to do your task. You can alternatively use Sql Server Export/Import Wizard .

Upvotes: 0

Related Questions