Solved

SQL Server bcp command

Posted on 2008-10-03
2
235 Views
Last Modified: 2012-05-05
I have to cammand below which is crewating a file...just not actually in excel format.  So I know I have my switches wrong for export to excel.

Some help here?

exec master.dbo.xp_cmdshell 'bcp "select * from database.dbo.table1" queryout C:\excelfile.xls -w -S SERVER\INSTANCE -T -E'
0
Comment
Question by:lrbrister
  • 2
2 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22634677
It won't.  You would have to export into character format which created a TAB delimited file and then import that into excel.  Just hope your data contains no tabs.
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22634681
Here is a link to the BCP utility syntax.

http://msdn.microsoft.com/en-us/library/aa174646(SQL.80).aspx
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now