Question : limit for ms sql

i have this query that shows the first 65500 results how would i make a query like this to show the next 65500 results (like limit 65001, 130000 in mysql)
SELECT TOP 65500
p.ProductCode AS id
, p.ProductName AS [stripHTML-title]
, IsNull(pe.Google_Product_Type,'n/a') AS product_type
, IsNull(pe.SalePrice,pe.ProductPrice) AS price
, IsNull(pe.ProductManufacturer,'n/a') AS brand
, 'Config_FullStoreURLProductDetails.asp?ProductCode=' + p.ProductCode + '&click=2&source=googlebase' AS link
, pd.ProductDescription AS [stripHTML-description]
, 'Config_FullStoreURL?'  + p.ProductCode + '-2.jpg' AS image_ink
, pe.ProductCondition AS condition
FROM Products p
INNER JOIN Products_Descriptions pd ON p.ProductID = pd.ProductID
INNER JOIN Products_Extended pe ON pd.ProductID = pe.ProductID
 
WHERE (p.IsChildOfProductCode is NULL OR p.IsChildOfProductCode = '')
AND (p.HideProduct is NULL OR p.HideProduct <> 'Y')
AND (pe.ProductPrice > 0)
 
ORDER BY p.ProductCode

Answer : limit for ms sql

Im MS -SQL there is no LIMIT clause or at least I couldn't make it work. You can try this:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
SELECT
	id,
	[stripHTML-title],
	product_type,
	price,
	brand,
	link,
	[stripHTML-description],
	image_ink,
	condition
FROM
(
SELECT
	ROW_NUMBER() over( order by p.ProductCode) as rownr,
	 p.ProductCode AS id
	,p.ProductName AS [stripHTML-title]
	,IsNull(pe.Google_Product_Type,'n/a') AS product_type
	,IsNull(pe.SalePrice,pe.ProductPrice) AS price
	,IsNull(pe.ProductManufacturer,'n/a') AS brand
	,'Config_FullStoreURLProductDetails.asp?ProductCode=' + p.ProductCode + '&click=2&source=googlebase' AS link
	,pd.ProductDescription AS [stripHTML-description]
	,'Config_FullStoreURL?'  + p.ProductCode + '-2.jpg' AS image_ink
	,pe.ProductCondition AS condition
FROM 
	Products p
	INNER JOIN Products_Descriptions pd 
		ON p.ProductID = pd.ProductID
	INNER JOIN Products_Extended pe 
		ON pd.ProductID = pe.ProductID
WHERE 
	(p.IsChildOfProductCode is NULL OR p.IsChildOfProductCode = '')
	AND (p.HideProduct is NULL OR p.HideProduct <> 'Y')
	AND (pe.ProductPrice > 0)
) q
	where q.rownr between 65001 and 130000	
ORDER BY 
	q.id
Random Solutions  
 
programming4us programming4us