Solved

Excel VB.net SQL Look at part of a table

Posted on 2014-10-07
2
177 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:murbro
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:murbro
ID: 40373730
Thanks very much
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

708 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

14 Experts available now in Live!

Get 1:1 Help Now