Fastest way to find row count of all tables in SQL

0 comments


Below is the syntax for the query which does exactly what the title suggests.


SELECT  T.NAME AS [TABLE NAME],I.ROWS AS [ROWCOUNT] 
FROM SYS.TABLES AS T INNER JOIN SYS.SYSINDEXES AS I 
ON T.OBJECT_ID = I.ID AND I.INDID < 2 
ORDER BY I.ROWS DESC 


.NET: Asynchronous Callback Approach in ADO.NET

1 comments

Note: Thank you for visiting my blog. However, this blog is not maintained actively anymore. This post is now also in my new blog. Feel free to leave a comment there.

I am studying Professional ASP.NET 4 in C# and VB book from Wrox Publication. It is a great book with really easy-to-understand basic examples. As I'm a novice in ASP.NET/.NET Framework, it really helped me a lot in understanding the technology. Wrox also lets you download the codes used in the examples in the books. Anyone interested can download the same from this link: Code for Professional ASP.NET 4 in C# and VB.

But sometimes, I found some mistakes in the examples, provided in the book. I tried the same code in my machine, but I was unable to produce the desired result. So  I'm going to discuss on a similar mistake I've found in the book recently and also going to discuss the workaround.

We're going to discuss on Asynchronous Callback Approach in ADO.NET. Before we jump straight  into the topic first let me explain what is Asynchronous Processing in ADO.NET.

Introduction

In general, in ADO.NET, each command is executed sequentially, i.e. code waits for the previous command to be completed before it starts executing the next command.
Asynchronous approach lets you do the processing in a parallel manner. Using this approach two sql commands can be executed in parallel using the same connection.This comes real handy when you are dealing with multiple data sources, like you have two GridView controls in your page, one for displaying employee's personal details, another for displaying the employee's payment change history. Apart from processing the command executions in parallel it also lets you perform other tasks(those are not dependent on the output of command execution) without completing the command execution.