Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel VB.net SQL Look at part of a table

Posted on 2014-10-07
2
Medium Priority
?
197 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
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

963 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