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
536 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql server string_split 4 28
count number 10 30
Combine Vlookup with indirect sheet reference 3 23
SQL Server View  - Timeout Expired 5 12
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

738 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