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

x
?
Solved

Exporting database to CSV files

Posted on 2010-09-21
6
Medium Priority
?
741 Views
Last Modified: 2012-08-14
Pardon me for posting this in slightly the wrong place. I don't see any option for SQL in general or SQL 2000.

I need to export a SQL2000 data to CSV files. One for each table. Everything I am seeing says to use DTS. Following the examples I have found, I seem to be missing a step. The screen shots show a step where you can choose what tables are exported. I'm not getting that option. I get a drop down of all the tables, so I can only pick one.

If there is a way to make this work, or someone can point out another way to export all the table to individual CSVs, that would be great.

Thanks!
0
Comment
Question by:Brian B
[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 5

Accepted Solution

by:
jijeesh earned 1600 total points
ID: 33729524
Use bcp you can do it..

declare @sql varchar(8000)
select @sql = 'bcp master..sysobjects out
                c:\bcp\sysobjects.txt -c -t, -T -S'+ @@servername
exec master..xp_cmdshell @sql


http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/
0
 
LVL 59

Expert Comment

by:HainKurt
ID: 33729527
what is "examples" or tools are you using? where is the screenshot?
0
 
LVL 12

Assisted Solution

by:jagssidurala
jagssidurala earned 400 total points
ID: 33731848
its is a simple application to get the csv file by entering the table name.

http://www.codeproject.com/KB/aspnet/ImportExportCSV.aspx

This link will give you an idea to get csv file by a sql query.
 
http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 25

Author Comment

by:Brian B
ID: 33748305
The link on the simple-talk website is almost exactly what I need. In fact I ran it and got all my data exported. Then I realized that BCP doesn't export the columns names. I have looked up how to include them, but again the samples are only written for one table, not the entire database.

Here's the code I am using to generate another page of code that I run to produce the export. How would I modify this to include column names?

select 'exec master..xp_cmdshell'
             + ' '''
             + 'bcp'
             + ' ' + TABLE_CATALOG + '.' + TABLE_SCHEMA + '.' + TABLE_NAME
             + ' out'
             + ' e:\export\'
             + TABLE_CATALOG + '.' + TABLE_SCHEMA + '.' + TABLE_NAME + '.bcp'
             + ' -t, -T -S' + @@servername
             + ''''
from INFORMATION_SCHEMA.TABLES
where TABLE_TYPE = 'BASE TABLE'
0
 
LVL 25

Author Comment

by:Brian B
ID: 33753871
I finally hit on the right combination of search words and found a great little utility called SQLtoTXT (http://www.withdata.com/sqltotxt.html) that did the trick. The trial version will only export the first 1000 records from each table, but I just did manual export for those.

Thanks everyone for your help and time.
0
 
LVL 25

Author Closing Comment

by:Brian B
ID: 33769627
Although this wasn't the final solution I used, the informationw as still helpful. Thanks!
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

705 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