troubleshooting Question

how to use bcp to save query output in excel with header

Avatar of thotwielder
thotwielder asked on
Microsoft SQL Server
8 Comments2 Solutions2202 ViewsLast Modified:
I need to export some select/ stored procedures results to excel files. I tried
Exec master..xp_cmdshell 'bcp TransactCIB.dbo.test out c:\Temp.xls -c -q -S"(local)" -U"sa" -P""'
to get the results to a excel file. But I can not get the headers. Is there anyway to include the header in excel file? please show details, thanks.
I use sqlserver 2000.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros