Solved

how to export excel csv file to sql

Posted on 2010-09-24
6
499 Views
Last Modified: 2012-05-10
how to export excel csv file to sql
0
Comment
Question by:DoctorDC
6 Comments
 
LVL 9

Assisted Solution

by:auke_t
auke_t earned 150 total points
ID: 33752730
I think you mean import?

Source = csv
Target = SQL server

Just start the import/export wizard in the Management Studio, rightclick the database and choose Tasks/Import data...
0
 
LVL 16

Accepted Solution

by:
carsRST earned 350 total points
ID: 33752755
If you're importing using VBA from Excel:
http://support.microsoft.com/kb/257819

If you want to use SQL Server SQL statement - openrowset
http://support.microsoft.com/kb/321686

Using SQL Server's ETL tool:
http://blogs.techrepublic.com.com/datacenter/?p=205
0
 
LVL 16

Expert Comment

by:carsRST
ID: 33752771
Sorry one more...

SQL Server's command line tool, BCP:
http://www.cryer.co.uk/brian/sqlserver/howtoimportcsv.htm

A little more about BCP
http://blogs.techrepublic.com.com/datacenter/?p=319
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 9

Expert Comment

by:Valliappan AN
ID: 33754207
I suggest not to use OpenRowSet since it often causes SQL Server to freeze, and not function on live servers. Try using add linked server, and that way you can export or import data.

e.g. http://forums.databasejournal.com/showthread.php?t=38583

Thanks.
0
 
LVL 3

Expert Comment

by:xiong8086
ID: 33759349
script should be like:

BULK INSERT targetTable
    FROM 'c:\file.csv'
    WITH
    (
        FIELDTERMINATOR = '\t',
        ROWTERMINATOR = '\n'
    )

for more complete example, can refer to the following link
http://blog.sqlauthority.com/2008/02/06/sql-server-import-csv-file-into-sql-server-using-bulk-insert-load-comma-delimited-file-into-sql-server/
0
 
LVL 3

Expert Comment

by:xiong8086
ID: 33759353
FIELDTERMINATOR should be  ',' instead of '\t'.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now