Solved

how to export excel csv file to sql

Posted on 2010-09-24
6
508 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

815 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

8 Experts available now in Live!

Get 1:1 Help Now