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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 BCP usage help

Author  Topic 

srivatsahg
Yak Posting Veteran

71 Posts

Posted - 2009-10-29 : 05:29:40
Hello

I need to export the results from a query(returning tables) to an excel/csv file using BCP. I used the
EXEC master..xp_cmdshell '
bcp ''THE SQL QUERY COMES HERE'' queryout 'C:\Export.xls' -c -C RAW

Though it said the query was executed successfully, i still cannot see the excel file. Anyone has a hint of whats happening here

Srivatsa

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-10-29 : 05:54:12
Hi

May be its useful..
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/10/10/export-to-excel-with-column-names.aspx






-------------------------
R...
Go to Top of Page

srivatsahg
Yak Posting Veteran

71 Posts

Posted - 2009-10-29 : 06:24:47
Thanks a ton ..
The link is quite useful


quote:
Originally posted by rajdaksha

Hi

May be its useful..
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/10/10/export-to-excel-with-column-names.aspx






-------------------------
R...


Go to Top of Page
   

- Advertisement -