Q:

Fetch 1 to 7 and 7-10 records

How to retrieve 7-10 record in sql server 2008
in tbl I  have 10 records in that i want only from 7th record to 10th record in sql   
I've used 
select * from tbl limit(7,10)
but this not valid in sql

A:

Try like this
MS SQL 2005+
SELECT Column1,Column2,..
FROM (
    SELECT ROW_NUMBER() OVER (ORDER BY (Select NULL)) AS RowNum,Column1,Column2,..
    FROM MyTable
) AS Tmp
WHERE Tmp.RowNum BETWEEN 7 AND 10

MS SQL 2012
SELECT * FROM MyTable ORDER BY ColumnName OFFSET 7 ROWS FETCH NEXT 3 ROWS ONLY;

OFFSET

