Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Paging T-SQL

Author  Topic 

irs2k3
Starting Member

22 Posts

Posted - 2010-08-31 : 15:50:02

I am trying to implement paging using Row_Number() method in this query but with no luck.

The following Query uses recursive way to get Sites for a set of categories.

I want to apply this to this query :

WITH hierarchy AS (
SELECT yt.id

FROM [dbo].[TH_Categories] yt
WHERE yt.ID = @topicID And CultureID = @cultureID
UNION ALL
SELECT yt.id

FROM [dbo].[TH_Categories] yt
JOIN hierarchy h ON h.ID = yt.ParentCategoryID)
Select id, [SiteName]
,[SiteURL]
,[Description]
,[Logo]
,[CultureID]
,[DateAdded], dbo.GetSiteFollowers(id) AS Followers from dbo.TH_Sites where id in (
Select Distinct SiteID from dbo.TH_CategoryFeeds Where CatID in (
SELECT ID
FROM hierarchy t ))

Thanks
   

- Advertisement -