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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS to export to excel file

Author  Topic 

reenz
Starting Member

29 Posts

Posted - 2006-03-29 : 08:00:02
I have a asp.net whereby user can dynamically create a sql statement by choosing the columns and tables names. I will then use a stored procedure to construct and execute the sql statement and return the results as a report form on asp.net page.

However, if the query is to be too big i would like to execute it on the ms sql server and return the query output as an EXCEL file. Can anyone give me a push in the right direction? I understand that DTS and bcp can do it but i'm totally clueless about what they are. Are they any articles i can read regarding using them to export data as an excel file.

Also, another concern is the max 65k rows excel support in 1 spreadsheet. How do i get DTS /bcp to "cut" the query results at say 40000 rows interval and insert them into the same excel file but different worksheets?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-29 : 08:07:15
See if you can follow this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

reenz
Starting Member

29 Posts

Posted - 2006-03-29 : 08:11:57
i read the article but it says that i need to create the excel file with the exact columns am i right?

However, the sql statement will be created dynamically meaning user can choose different columns from different tables. Hence i am not able to create the excel file beforehand. Is there any way to create the excel file dynamically as well depending on the query?
Go to Top of Page
   

- Advertisement -