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 |
|
DirkMartin
Starting Member
2 Posts |
Posted - 2004-06-01 : 23:45:31
|
| I've got SQLServer 2000 as the backend to my VB app. It's installed at several sites. I need to write an export routine in VB that'll export data from the DB to Excel. I can't create a DTS package for each client.Is there a "select..." statement that I can execute within VB that'll perform an export to Excel? |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-06-02 : 00:21:47
|
| There's not a specific statement for exporting to Excel. You need to create a Recordset using a standard SQL statement, then write the recordset results to Excel using Excel's OLE capabilities.Tim |
 |
|
|
DirkMartin
Starting Member
2 Posts |
Posted - 2004-06-02 : 00:38:19
|
| There is a Select statement I could execute from within VB that would export an Access database to Excel. Such as:"...into [Excel 8.0;Database=C:\temp\test.xls].[Sheet1]..."Is there a Select statement that I could run against my SQLServer data to dump to Access? |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-06-02 : 01:05:55
|
| You could use linked servers to do this, but you'd need to set up a link for each database.Why don't you set up an Access database with a series of linked tables? Surely this would be much easier. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-06-02 : 03:39:57
|
| The jet povider will handle excel so you should be able to use that to write to the spreadsheet. It works from a t-sql so should work from VB.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|