Solved

Excel VB.net SQL Look at part of a table

Posted on 2014-10-07
2
183 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

777 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