Solved

how to export excel csv file to sql

Posted on 2010-09-24
6
515 Views
Last Modified: 2012-05-10
how to export excel csv file to sql
0
Comment
Question by:DoctorDC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

632 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