Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transfer data from Excel to SQL Server

I have an Excel Spreadsheet that contains all my data that I need to put into an SQL Server database. I am fairly new o ASP.NET and have never had to export from Excel to SQL Server before.

My Excel spreadsheets looks like this

Trade Heading -> ArtID -> BusinessName -> AdStyleCode -> Address -> Suburb

In SQL Server I have created a table named "Listings" which is in this format

intListingID -> intCategoryID -> BusinessName - ArtID -> intAdCode ->Address -> Suburb

What would be the best way to export the data from Excel and then import it into SQLServer 2005.

Thanks...

like image 984
Jason Avatar asked Apr 06 '09 08:04

Jason


People also ask

How do I transfer data from Excel to database?

Click on the Databases tab, and drop your Excel file in the Select Table column. This will launch a window that lets you verify your column names. If it's all looking good, give the table a name, and click on Create Table. You're done!

How do I import Excel data into SQL Server using SSIS?

On the SSIS menu, select New connection. In the Add SSIS Connection Manager dialog box, select EXCEL and then Add. Create the connection manager at the same time that you configure the Excel Source or the Excel Destination on the Connection manager page of the Excel Source Editor or of the Excel Destination Editor.

Can you create a SQL database from Excel?

The SQL Spreads Table Creator is a new feature in SQL Spreads 5.0 to create SQL Server tables directly from within Excel and pre-load them with the existing data in your Excel spreadsheet. The Table Creator makes it possible to create SQL Server tables in just a few clicks.


1 Answers

You can do this easily using SSIS, you can refer to these two links for full details.

  1. Link 1
  2. Link 2

[EDIT]

If you have Express then you can try the below commands to setup a linked server and get the data

EXEC sp_addlinkedserver ExcelData,'Jet 4.0','Microsoft.Jet.OLEDB.4.0','C:\MyData.xls', NULL, 'Excel 5.0;'
GO

Then you can select the data into your tables

INSERT INTO Listings ...
SELECT column1 AS intListingID, <put all columns here> FROM ExcelData...Data
GO

For other options check this link

like image 175
Binoj Antony Avatar answered Sep 28 '22 18:09

Binoj Antony