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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now