Jun 21st, 2009 | 3 Comments

Since I am looking for a job change and this is the question I’m being asked in all of my interviews, I am sharing this with everyone hoping this will help you guys.

The most common type of question is find out the 5th highest value, find out the 2nd highest value, and so on.

The solution for this question goes like this, I am going to fetch 5th highest salary for an employee.

Select top 1 FirstName, Salary From Employees Where Salary Not In (Select Distinct Top 4 Salary From Employees order by Salary desc) order by Salary desc

Enjoy and have fun :)

Written by Ajay Matharu

June 21st, 2009 at 1:51 pm

Jun 12th, 2009 | No Comments

To get MD5 hash in C# use this method. It returns same value AS MD5() function in PHP

        public string GetMD5Hash(string input)
        {
            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
            bs = x.ComputeHash(bs);
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            foreach (byte b in bs)
            {
                s.Append(b.ToString("x2").ToLower());
            }
            string password = s.ToString();
            return password;
        }

And this one is in PHP


These both will return the same value

Written by Ajay Matharu

June 12th, 2009 at 10:32 am