Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to export excel csv file to sql

Posted on 2010-09-24
6
Medium Priority
?
517 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 600 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 1400 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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…
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…

721 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