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)
 Exporting to Excel

Author  Topic 

rk4u
Starting Member

8 Posts

Posted - 2001-12-19 : 18:35:51
Could someone guide me in the right direction, I would like to retrieve data from multiple tables in SQL Server 6.5 and export to a excel spreadsheet so that I can analyze the data. This needs to be automated and the spreadsheet must be updated every 15 minutes. I appreciate any suggestions.

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2001-12-19 : 18:43:45
rk4u,

I recently had to do something very similar....

First option was get a recordset to your middle tier, loop through it and write to Excel...

Second Option was to use DTS on a schedule (Job)

The DTS option was orders of magnitude faster.

Possibly problems..
You need to create different Excel files.. requires a bit of ActiveX scripting...
SQL Server 6.5 DTS engine (Does it have one?)

DavidM

"Why are you crying?"

"Because I love a Microsoft product"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-19 : 18:44:17
You can create a job that runs every 15 minutes to export the data using bcp into a tab or comma-delimited file, which you can then open in Excel, but it won't work with an existing Excel file. If you add formulas and such they will be wiped out the next time the file is generated.

If you have another SQL Server version 7.0 or higher, you could write a DTS job that transfers data from 6.5 to Excel. This might sound dumb but I found this to be very handy and reliable. The DTS job can also be scheduled to run every 15 minutes.

Another option is to create an Excel workbook and use Get External Data to "link" to the SQL Server tables or queries you need. You can refresh the data at any time, but there won't be an automatic update at some specified interval.

Keep in mind that if you have the Excel file open, DTS or bcp jobs will not run successfully because of file sharing violations. Excel is very particular about this. I think the only method that will really work for you is Get External Data.

SNIPED AGAIN! You're killing me David!

Edited by - robvolk on 12/19/2001 18:45:04
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-19 : 18:45:17
You could accomplish this with a scheduled job running a DTS task which does an export to Excel.

BUT, considering the refresh rate, you might want to look at "pulling the data" from Excell rather than "pushing" it from SQL. By that I mean that in Excell you can setup a link into your SQL Server and run a query. This will then be a live picture everytime you do a refresh or open the file. I've done this many times to create Excel Pivot Tables. Look in the Excel help for topics on "External Data Sources" or something like that.

DOUBLE SNIPED!! What's up with that?!
-------------------
It's a SQL thing...

Edited by - AjarnMark on 12/19/2001 18:46:54
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-19 : 19:15:55
How does the saying go, "Great minds think alike"?

Or is it "Sick minds think alike"?

Both!

David's on a tear lately...

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-19 : 20:02:17
quote:
David's on a tear lately...



Yeah, 34 more posts and he hits the coveted Members, Page 1 position. After that, he'll be violating innocent constraints in no time.

-------------------
It's a SQL thing...
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-19 : 20:13:01
quote:
After that, he'll be violating innocent constraints in no time.


No, he'll be having proscriptive relations with tuples, one at a time! Eeeeeeeeeewwwwwwwwwwwwwww!

(sorry, couldn't help it)

Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2001-12-19 : 20:27:49
Keep my sex life out it!

DavidM

"Why are you crying?"

"Because I love a Microsoft product"
Go to Top of Page

rk4u
Starting Member

8 Posts

Posted - 2001-12-20 : 10:20:07
Thank you for pointing me in the right direction, you all been a great help.
Go to Top of Page
   

- Advertisement -