Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Viewing the result of an sql query in excel.

Hi I try this Q here instead since i was recommended this:

"Hi Kjell
There used to be a way to dynamically link Excel to databases, but I think
MS had to remove it due to some kind of lawsuit. Best would be to ask this in
the Excel.programming newsgroup, as the specialists there will know for sure.
-- Cindy Meister (Word MVP)"
:

My QUESTION:

Hi.
Background:
I have created an add-in for excel that opens a form that lets the user
graphically select what data he wants to view. The result of the input is
formatted as an sql string, and I want to show the result of the query in an
excel document.
* the result file i quite big. 256*100 000 rows i might add

I am considering the following:

1. Copy data from the Sql server to an Excel sheet. Something like this:

Sheet1.Range("A1").CopyFromRecordset myrecordset

2. Is there a way, programmatically, to let excel directly show the result
from the sql-query through a "view-connection " to the database? So to say
that Excel always shows what data the sql server contains.

I would prefer the last solution if that is possible.

Or is there any other smart way to do this?

Best Regards Kjell Nilsson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default Viewing the result of an sql query in excel.

The Giant Killer here is this one little line:
* the result file i quite big. 256*100 000 rows i might add.

Now I read that one of 2 ways (neither of which is very good):
256 columns by 100,000 rows
or
256 groups of 100,000 rows

Prior to Excel 2007, the maximum number of rows on an Excel spreadsheet is
65,536. Excel 2007 will handle 2^20 rows (1,045,576 rows) per sheet. With
this in mind, if your 256x100,000 is columns by rows, Excel 2007 could handle
the load, but if it is 256*100,000 = 25,600,000 rows, then you're going to
need Excel and 26 worksheets in it and some special processing to split the
data across the sheets [I happen to have just such an Excel tool already
built :-) ... but it reads from a .txt, .dat or .csv type file= :-( ]

Because of this limitation I'm going to say that even the answer to #2 is
no. Excel really doesn't do it's data retrieval 'live' and in real time.
It's more like returning a snapshot recordset using the SQL statement.



"kjell nilsson" wrote:

Hi I try this Q here instead since i was recommended this:

"Hi Kjell
There used to be a way to dynamically link Excel to databases, but I think
MS had to remove it due to some kind of lawsuit. Best would be to ask this in
the Excel.programming newsgroup, as the specialists there will know for sure.
-- Cindy Meister (Word MVP)"
:

My QUESTION:

Hi.
Background:
I have created an add-in for excel that opens a form that lets the user
graphically select what data he wants to view. The result of the input is
formatted as an sql string, and I want to show the result of the query in an
excel document.
* the result file i quite big. 256*100 000 rows i might add

I am considering the following:

1. Copy data from the Sql server to an Excel sheet. Something like this:

Sheet1.Range("A1").CopyFromRecordset myrecordset

2. Is there a way, programmatically, to let excel directly show the result
from the sql-query through a "view-connection " to the database? So to say
that Excel always shows what data the sql server contains.

I would prefer the last solution if that is possible.

Or is there any other smart way to do this?

Best Regards Kjell Nilsson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Viewing the result of an sql query in excel.

To add to other comments:
I would question the worth of showing the user that much data. Would they
actually look at it all ?
Provide the user some means to filter the results and only display those of
interest. That would greatly simplify you task and provide the user with
<useful data. There is no point in just duplicating such a large dataset
and requiring XL2007 for it to work.

As for updating the data, you can use a database query and set the fresh
period to some suitable period. Whilst I would not advise a 'live" update
(<30 sec), every 5 minutes or so should be OK, depending on amount of data
and network/server speeds.

NickHK

"kjell nilsson" wrote in message
...
Hi I try this Q here instead since i was recommended this:

"Hi Kjell
There used to be a way to dynamically link Excel to databases, but I think
MS had to remove it due to some kind of lawsuit. Best would be to ask this

in
the Excel.programming newsgroup, as the specialists there will know for

sure.
-- Cindy Meister (Word MVP)"
:

My QUESTION:

Hi.
Background:
I have created an add-in for excel that opens a form that lets the user
graphically select what data he wants to view. The result of the input is
formatted as an sql string, and I want to show the result of the query in

an
excel document.
* the result file i quite big. 256*100 000 rows i might add

I am considering the following:

1. Copy data from the Sql server to an Excel sheet. Something like this:

Sheet1.Range("A1").CopyFromRecordset myrecordset

2. Is there a way, programmatically, to let excel directly show the

result
from the sql-query through a "view-connection " to the database? So to say
that Excel always shows what data the sql server contains.

I would prefer the last solution if that is possible.

Or is there any other smart way to do this?

Best Regards Kjell Nilsson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy paste SQL query result to excel spreadsheet with formatting Juliet Excel Worksheet Functions 1 October 1st 08 07:23 PM
Query on how I would calculate a result in Excel? confused Excel Worksheet Functions 3 December 6th 06 10:10 AM
Importing result from Access query to Excel but the result only c. Edwin Excel Discussion (Misc queries) 0 March 16th 06 01:36 AM
Micosoft Query does not export result set to excel Peter McAuley Excel Worksheet Functions 0 June 16th 05 08:53 PM
Returning the result of an SQL/Query to Excel Hans Weustink[_3_] Excel Programming 1 August 13th 04 02:19 PM


All times are GMT +1. The time now is 12:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"