Groups | Blog | Home
all groups > sql server programming > november 2006 >

sql server programming : Need help in "bcp" utility.......



amit
11/21/2006 11:27:30 PM
Hi All,

I am trying to export the data in a excel file using "bcp". right now i
am exporting data from two different table in two separate files and it
is running fine. But, i want the data of two tables in a single excel
file but in separate sheets.

Please suggest.

Thanks in advance.
Uri Dimant
11/22/2006 12:00:00 AM
Hi,Amit


Sorry, could not tested it right now


INSERT INTO OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\MyExcel.xls";User
ID=Admin;Password='
)...Book1$ (columns )
SELECT columns FROM Table1

INSERT INTO OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\MyExcel.xls";User
ID=Admin;Password='
)...Book2$ (columns )
SELECT columns FROM Table2





[quoted text, click to view]

Hilary Cotter
11/22/2006 9:53:38 AM
Bcp is not the right tool for this. It is used to extract data from SQL
Server and send it to a file which is largely binary. You can also use it to
send data to SQL Server.


--
Hilary Cotter

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

AddThis Social Bookmark Button