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
 General SQL Server Forums
 New to SQL Server Programming
 bcp output to excel column width

Author  Topic 

cjcclee
Starting Member

33 Posts

Posted - 2013-12-10 : 14:44:39
Hi, all

I use bcp command to output to excel, it works. But I want to format the excel, some column width are too small,user need adjust the column width, otherwise it shows ######.
how can I set columns width when I use bcp output to excel.
Also, can bcp command output to multiple excel sheets and add report title in each excel sheet?
Thank you!

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2013-12-10 : 15:09:29
Possibly CASTing number columns to VARCHAR can help you BUT still for formatting you have to edit excel sheets manually

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-11 : 05:17:26

Also, can bcp command output to multiple excel sheets and add report title in each excel sheet?

For exporting to multiple excel sheets here are two options you can use.

http://visakhm.blogspot.com/2013/09/exporting-sqlserver-data-to-multiple.html

http://visakhm.blogspot.com/2013/10/using-ssrs-to-export-sqlserver-data-to.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -