Ping Reply with IPv6 not IPv4

Many times as a developer you need to ping one machine especially in multi-tier  farms.

If you ping one machine you will some time get reply in IPv6 format rather than IPv4.

Example:

Solution

To force the PING reply with IPv4, do the following:

Ping <hostname> -4

Advertisements

How to Know When Your Server was Rebooted

In many cased you need to know when your server was rebooted or how many times your server was rebooted during one month for example.

To do this, we will use the event viewer 😉 two things

  • Event Id 6005:  you will see this event when the event log service was started, but this means that your server was rebooted suddenly.
  • Event Id 6006: this one is when the even log was stopped, but this means that your server was rebooted normally.

Custom Paging In SQL Server 2012 (Denali)

SQL Server 2012 solved big problem in custom paging with easy way. lets start.

The paging now can be done using ORDER clause.

  • Return all rows sorted by FirstName
SELECT[Title]
      ,[FirstName]
      ,[MiddleName]
      ,[LastName]

  FROM [AdventureWorks2012].[Person].[Person]
  ORDER BY FirstName ASC
  • Skip the top 10 rows and return all the next rows, OFFSET <int> ROWS (NEW)
SELECT[Title]
      ,[FirstName]
      ,[MiddleName]
      ,[LastName]

  FROM [AdventureWorks2012].[Person].[Person]
  ORDER BY FirstName ASC
  OFFSET 10 ROWS
  • Paging (NEW)
DECLARE @PageSize int;
SET @PageSize=10;

DECLARE @CurrentPage int;
SET @CurrentPage=0;

SELECT[Title]
      ,[FirstName]
      ,[MiddleName]
      ,[LastName]

  FROM [AdventureWorks2012].[Person].[Person]
  ORDER BY FirstName ASC

  OFFSET (@PageSize * @CurrentPage) ROWS FETCH NEXT @PageSize ROWS ONLY