Solved

export data from table to flat file

Posted on 2011-03-17
5
515 Views
Last Modified: 2012-05-11
Hello There,

How can I export the data from a table to a flat file. I am using SQL Server 2005.

Any ideas.

Thanks.
0
Comment
Question by:theartha
5 Comments
 
LVL 3

Expert Comment

by:dtrance
ID: 35158476
There are a few ways to do this.  Either by using the import/export option or simply right clicking on the results table after running your query, and "save results as.."
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 35158497
You could use bcp.

For example

BCP "select * from table" queryout "C:\flatfile.csv" -T -S SERVERNAME -c -t,

Open in new window


You would run this from the command line.
0
 
LVL 4

Expert Comment

by:qasim_md
ID: 35158751
Try BCP Statements with QUERYOUT.

Check this link for detailed solutions for your requirement and needs.

http://msdn.microsoft.com/en-us/library/ms162802.aspx
0
 
LVL 4

Accepted Solution

by:
qasim_md earned 500 total points
ID: 35158786
OR another quick option from the SQL server Management Studio > right click on the Database the table exists> Click on Tasks > Click the Export Data and you will find the options in the NEXT > NEXT options...

did that help ?
0
 

Author Closing Comment

by:theartha
ID: 35159098
Thank You. It helped
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

789 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