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.
Author |
Topic |
badkneecap
Starting Member
10 Posts |
Posted - 2008-03-30 : 17:55:11
|
I'm trying to export data from an SQL table using classic ASP. In the past, I have created tab delimited text files using code similar to the following code:Response.AddHeader "Content-Disposition", "attachment;filename=results.txt"Response.ContentType = "application/octet-stream" Response.Write "Field1"&vbTABResponse.Write "Field2"&vbTABResponse.Write "Field3"&vbTABResponse.Write vbCRLF RSb.Open "SELECT * FROM tblData1 WHERE ID=1 ORDER BY txtField1", con, 3, 3Do Until RSb.EOF Response.Write RSb("txtField1")&vbTAB Response.Write RSb("txtField2")&vbTAB Response.Write RSb("txtField3")&vbTAB Response.Write vbCRLF RSb.MoveNextLoopRSb.CloseThis always worked fine in the past because the tables were small. Now, the tables are exporting 100,000 records and getting errors. I'm setting the page timeout and the sql connection timeout, but I'm still getting errors. I'm not exactly sure what's happening, but the export stops after exporting about 5Mb. It varies where it stops, so I'm thinking it's timing out somewhere.Is there a better way to do this? Possibly use an export function in MS SQL that would export faster?TIA- PR |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-03-30 : 18:01:14
|
What was the error? Tried with bcp? |
 |
|
badkneecap
Starting Member
10 Posts |
Posted - 2008-03-30 : 18:41:32
|
No error, download stops. Eventually, the page times out and generates a "Page cannot load" or something like that.No, I have not tried bcp. What I like about doing it the way I am now is that the user selects the name and location of the file. Can I do this with bcp?- PR |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-30 : 19:21:32
|
Yes. The BCP command accepts filenames. E 12°55'05.25"N 56°04'39.16" |
 |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-03-31 : 01:38:53
|
Try it from within SQL Server via Query Analyzer.Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
|
|
|
|