Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Export data into CSV using query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Syamsul Izwani
Starting Member

Malaysia
1 Posts

Posted - 09/22/2012 :  05:07:28  Show Profile  Reply with Quote
Hi,
How to export data from table into csv file just using query?
I want to download the data using CSV file did anyone know how to do this????

SYAMSUL

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/22/2012 :  08:49:16  Show Profile  Reply with Quote
You can use bcp - there are examples on this MSDN page: http://msdn.microsoft.com/en-us/library/ms162802.aspx

BCP is a command that you run from a command line on the OS. To run it as a query, you will need to use xp_cmdshell: http://msdn.microsoft.com/en-us/library/ms175046.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 09/22/2012 :  12:51:58  Show Profile  Reply with Quote
make sure xp_cmdshell is enabled in server before you use it. By default xp_cmdshell will be disabled and you've run sp_configure to enable it

see

http://blog.sqlauthority.com/2007/04/26/sql-server-enable-xp_cmdshell-using-sp_configure/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000