Solved

how to export excel csv file to sql

Posted on 2010-09-24
6
503 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

18 Experts available now in Live!

Get 1:1 Help Now