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
535 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

756 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