Solved

Getting data from SQL using VBA in Excel - should I use views with Sum or do the summing via VBA

Posted on 2008-10-09
2
533 Views
Last Modified: 2012-05-05
I am using Excel VBA to get data from SQL tables.  I need to sum a large amount of data.  Am I better off creating Views in SQL that do the summing and then querying those views or can I just query the table and use a While loop to query the data.  I suppose a 3rd option would be to sum the data using the query right in VBA too.  So of those three options, which one is "better" and would be faster?

Thanks

Doug
0
Comment
Question by:dougshepard
2 Comments
 
LVL 5

Accepted Solution

by:
Cvijo123 earned 500 total points
ID: 22682269
there is easy answer for this .. always use sum in SQL part, eather direct in your sql select or in views.
Summing data in your exel VBA would be 100 times slowier than doing it on SQL side with aggregate functions.
0
 

Author Comment

by:dougshepard
ID: 22741130
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question