Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

T-SQL Tips: OFFSET Without FETCH i.e. Skipping Rows in Resultset

AddThis Social Bookmark Button
Introduction
The purpose of this blog is to provide an answer to the below two questions

Can we use OFFSET without FETCH in T-SQL?How can we skip some rows while returning a resultset through SQL query?
The above questions were asked multiple times to me by different people and in different forums. I'm publishing this blog to give a combined answer to both these questions

Illustration
Let me explain this with an illustration
The scenario under consideration is like this

Consider the case where we have payments made by customers as per invoices provided in a retail scenario. The same customer can
do multiple payments in a month 

This can be represented using a table with the below structure

declare @t table
(
Customer varchar(10),
Price decimal(15,2),
PaidDate date
)

insert @t
values 
('Cust1',1000,'20150112'),
('Cust3',300,'20150120'),
('Cust2',2300,'20150115'),
('Cust1',1600,'20150322'),
('Cust3',1800,'20150512'),
('Cust1',1100,'20150610'),
('Cust2',2450,'20150622'),
('Cust5',900,'20150618'),
('Cust6',340,'20150812'),
('Cust4',570,'20150823'),
('Cust3',800,'20151112'),
('Cust2',1200,'20151125'),
('Cust4',3200,'20160119'),
('Cust5',4200,'20160123'),
('Cust3',5300,'20160111'),
('Cust6',2100,'20160203')

The above data represents the various payments made by customers along with the date of payment information
The requirement is to get the top 3 customers from this based on the total payments done. In addition we also need to get the total payment done by all the other customers. This is for listing the details in a report 
Now lets see how the above requirement can be achieved by using the OFFSET.. FETCH syntax which is...(Read whole news on source site)

Speech to Text (and more) with Windows 10 UWP & ‘Project Oxford’

AddThis Social Bookmark Button
We’re increasingly talking to machines and, more importantly, they’re increasingly listening and even starting to understand. In the world of the Windows 10 Universal Windows Platform, there’s the SpeechRecognizer class which can do speech recognition on the device without necessarily calling off to the cloud and it has a number of different capabilities. The recognizer … Continue reading Speech to Text (and more) with Windows 10 UWP & ‘Project Oxford’ →

Answering a code test like a literature pop quiz

AddThis Social Bookmark Button
We get some… fascinating replies from candidates to our code tests. Some of them are so bad that I really wish that I could revoke some people’s keyboard access: Case in point, we had a promising candidate from Israel’s equivalent of MIT (Technion, which is in the top 25 engineering schools in the world). He submitted code that went something like this: var nameFirstChar = char.Parse(name.Substring(0,1).ToLower()); switch (nameFirstChar) {
case 'a': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_A.csv"), true)) { indexFile.WriteLine(name); } break; case 'b': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_B.csv"), true)) { indexFile.WriteLine(name); ...(Read whole news on source site)

The Morning Brew #2027

AddThis Social Bookmark Button
Information ASP.NET Core Embedded Resource – Derek Comartin takes a look at using Embedded Resources in ASP.NET Core projects The New Fetch Standard – K Scott Allen takes a look at the Fetch API, proposed as the future replacement for XMLHttpRequest for retrieving data in JavaScript GitHub Activity Guilt and the Coder’s FitBit – Scott […]

VS Team Services incidents on Feb 3 & 4

AddThis Social Bookmark Button
We had two serious availability incidents in the past 2 days.  I’m incredibly sorry for the problems that these have caused.  Increasingly we are bringing on more and more customers who rely on this service day in and day out and any significant interruption is entirely unacceptable.  We know it.  We live it.  We breath... Read more

The SQL Server 2016 Query Store: Accessing Query Store Information Using DMVs

AddThis Social Bookmark Button
The SQL Server 2016 Query Store provides several new ways of troubleshooting queries, studying their plans, exploring their context settings, and checking their performance metrics. In using the Query Store to ensure that performance is as good as possible, it isn't long before it becomes important to be familiar with the DMVs that are associated with the query store, and using them in custom queries.

Thinking About the Cloud?

AddThis Social Bookmark Button
Are you thinking about the cloud yet? Redgate is conducting some research into cloud adoption to better understand both the drivers and the blockers. Whether or not you’ve taken the plunge yet, they would love to hear from you. Participate in the survey and be entered into a draw to win an Amazon gift card worth $100.

Home