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 |
csmoniz
Starting Member
5 Posts |
Posted - 2010-07-14 : 14:50:55
|
Dear Friends.How can I read a result of an SQL query directly to an Excel table?I'm using SQL Server 2000.ThanksCezar Moniz |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
csmoniz
Starting Member
5 Posts |
Posted - 2010-07-14 : 15:43:56
|
Tara Kizer.Basically I need the following:Draw a graph in Excel with the results of queries. Perhaps even better to make a dynamic table, but I have read from a table in SQL.Do you have any suggestions?Thank´s a lot |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-07-14 : 17:29:57
|
I can only help exporting data from SQL Server into a csv file (Excel can read a csv file). I haven't a clue how you would graph it.Here's an example of bcp:bcp.exe Db1.dbo.Tbl1 out C:\temp\SomeFile.csv -t, -Sserver1\instance1 -T -c -r\r\nRun bcp /? from a command window to see its options or check Books Online. Alternatively you could use SSIS to create the Excel file, but bcp is so simple with a csv file. You can even do queries instead of an entire table:bcp.exe "select * from Db1.dbo.Tbl1 where column1 > 999" queryout C:\temp\SomeFile.csv -t, -Sserver1\instance1 -T -c -r\r\nIf the query becomes too complex for bcp, then you would need to wrap it into a view and then bcp the view out.SSIS can do very fancy transformations and exports, so maybe you should look into that if bcp.exe isn't enough for your issue.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
csmoniz
Starting Member
5 Posts |
Posted - 2010-07-14 : 18:25:18
|
My friend.I think you could see the problem and i agreed with the solution.I will follow your suggestion. I will do the queries and views and try.I was trying with WebComponet. But it did not work.Thank´s a lot. |
|
|
|
|
|