Paging in SQL

Many times, it is required to implement paging in SQL. Well you can find many ways to accomplish it but recently I came across to a very simple way of doind this.
 
Consider you want to find the records from 21-30 in order of their IDs, then you can do this using the folllowing query:
 
SELECT     TOP 10 *
FROM         (SELECT     TOP 30 *
                       FROM          tableName
                       ORDER BY ID)
ORDER BY ID DESC.
 
Yup it is a very easy and handy way to implement paging.

Salary Theorem

Have you ever wonder why scientists and engineers earn leass than businessmen, salesmen, politicians and actors. It is all because of Salary Theorem which state that:
 
"Less knowledge you have, more you will earn and more knowledge you have, less you will earn."
 
Mathematically,
 
Since Power = Work / Time
 
and Power = Knowledge
and Time = Money
 
Therefore, Knowledge = Work / Money
and Money = Work / Knowledge
 
Hence keeping Work constant Money is inversely proportional to Knowledge. Similarly work is the product of knowledge and money. Greater knowledge you have, more you have to work keeping money constant.

Validating numeric data type

Many times we face the situation where we want to validate whether user input is numeric or not. In .Net it is reallly esy to validate the data type of user input using Regular Expressions. An example of how to validate that the data type of user input is numeric is:
 

bool Validate(string text)

{

Regex reg=new Regex(@"\D");

return !reg.Match(text).Success;

}

 

Here if text contains only digits then the result of reg.Match is false, so Validate will return true and vice versa. Here decimal point is also considered as non digit and will cause the result of the function to be false.

 

Now the following code snippet will recognize the period "." as the part of the digits also but more than one periods will not cause error i.e 123.45.67 will also return true.

 

bool Validate(string text)

{

Regex reg=

new Regex(@"[^0-9.]");

return !reg.Match(text).Success;

}

Still in Office

Well its 2 p.m. here in Dubai but I m not on lunch. Why cauz I have a temperature of 102 from yesterday night and I can barely walk but still in office. I used to think that I m a person who can live without any other one but today I didnt stay at home and came to wok so that I will have someone to talk, someone who will care while I m feeling ill. I have just eaten Baunty from moring and doesnt want to eat anything else in this afternoon. Lets see whether I ll be able to spend rest of the day in office while working;)
 
I just want to add one thing. I spent 1 hour in the morning in the office while sleeping in washroom