Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

SQL Server bcp command

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'
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

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.
ASKER CERTIFIED SOLUTION
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial