JayaC


How can I store the results of a SQL query in a excel/csv file




Re: Store query output in a excel file?

TimDBA


There are a few ways to do this...you could use the bcp utility, or you could use dts to export the data from a SQL Server database to an excel file.






Re: Store query output in a excel file?

JayaC

Thanks.




Re: Store query output in a excel file?

Sandya

When using BCP to export data into Excel, all the columns in a row goes as tab demilited into a single cell.

Exec Master..xp_cmdshell 'bcp "SELECT * FROM tblregstore" queryout C:\stores.xls -c -t'

What parameters do I need to add to export each column data into a seperate cells

Thanks,
Sandya