Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting data from Excel to a SQL table 2

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
US
I need assistance exporting data from an Excel Spreadsheet into an existing SQL table (table A). I used the Import Export Wizard to export the data from Excel into SQL, however that created an additional table (table B). Is it possible to export data from Excel into an existing table using the Import Export Wizard? If not, how do I add the data from the newly created table B to table A?

Thanks in advance for your assistance.

Ingrid
 
I don't pull data from Excel to SQL Server, so can't help with that part of the issue. However, what I can help with is getting data from one SQL Server table to another. Use this code to copy the data from the new table into the one you actually want it in. You will have to list the actual column names in both the INSERT and SELECT parts of the code. The columns have to be in the same order in both parts.

Code:
INSERT INTO TableA (col1, col2, col3, ...)
 (SELECT col1, col2, col3, ....  FROM TableB)
GO

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Now that the table's been created, you can go through the wizard again and point it at the existing table, instead of creating a new one. Then you can save the wizard bits as an SSIS package, and re-use it/tweak it in BIDS/schedule using a job/whatever.

-----------
With business clients like mine, you'd be better off herding cats.
 
Thanks for your help. I really appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top