Solved

Excel VB.net SQL Look at part of a table

Posted on 2014-10-07
2
189 Views
Last Modified: 2014-10-10
Hi


I have a VB.net Excel Add-in where I would like the user to look at data in SQL tables.
The tables are a few million records each so pulling all the data through is not an option.
I want the user to be able to look at around 10000 records at a time.
What is the best way to do this? What SQL syntax would I use?
0
Comment
Question by:Murray Brown
[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 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40365450
If you are using Microsoft SQL Server 2012 or 2014, then I would use the OFFSET FETCH command, i.e.

Select *
From MyTable
ORDER BY MyFields
OFFSET 0 ROWS FETCH NEXT 10000 ROWS ONLY

Open in new window


Replacing the "0 ROWS" with the relevant row number you are. Please note that the ORDER BY line is compulsory when you are using OFFSET...FETCH.
0
 

Author Closing Comment

by:Murray Brown
ID: 40373730
Thanks very much
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

635 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