Tuesday 27 March 2007

Paging with MS SQL Server 2005

Paging can be easily achieved in MS SQL Server 2005 by using the ROW_NUMBER function and CTE (Common Table Expressions). The ROW_NUMBER function provides the ability to issue a query and just return a subset of the result set and the CTE allows us to define the temporary result set with clause. The below example shows how to retrieve first ten Patients from a result set using the CTE and ROW_NUMBER function.

USE Patient_DB;
GO
WITH PatientDetail
AS
(
SELECT
Surname,
Forename,
Age,
ROW_NUMBER() OVER (order by Surname) AS 'RowNumber'
FROM Patient
)
SELECT * FROM
PatientDetail
WHERE
RowNumber between 1 and 10;
GO

The OVER clause is used to determine the partitioning and ordering of the intermediary result set before the ROW_NUMBER function is applied. The SELECT statement can be parameterized to retrieve data for the specified Range as given below.

USE Patient_DB;
GO
WITH PatientDetail
AS
(
SELECT
Surname,
Forename,
Age,
ROW_NUMBER() OVER (order by Surname) AS 'RowNumber'
FROM Patient
)

SELECT * FROM
PatientDetail
WHERE RowNumber between
@RowNumberFrom and @RowNumberTo;
GO

Monday 26 March 2007

World’s Fastest Optical chip

IBM has announced Monday an optical chipset that could allow you to download a complete high-definition movie in one second, rather than the 30 minutes or more that today's fastest chips allow.
Measured in another way, the chipset can transmit the equivalent of four million simultaneous telephone conversations. The company said that the optical transceiver can move data at up to eight times more quickly than the fastest existing optical chips -- up to 160 Gbps.
The optical transceiver chipset moves information as light signals, not as electrical signals, and IBM said it could be available by 2010.
the new optical chipset, only one-fifteenth the size of a dime, can be manufactured with high-volume techniques and so could result in low-cost products. They could be integrated into printed circuit boards for PCs or set-top boxes.
More details at
http://www.sci-tech-today.com/story.xhtml?story_id=12200CQ3ZX4E