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.
| Author |
Topic |
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2007-07-02 : 19:19:09
|
| WITH Categories AS (SELECT ROW_NUMBER() OVER (ORDER BY SortOrder) As RowNum, CategoryID, [Name], [Description], ParentID, SortOrder, Hidden, FROM Category WHERE ParentID=@ParentID) SELECT *, (SELECT COUNT(*) FROM Categories) AS TotalRowCount FROM Categories WHERE RowNum BETWEEN (@StartRowIndex + 1) and (@StartRowIndex + @MaximumRows) ORDER BY RowNum---I can understand the top section where it is pulling all the columns, with the 1st column being the RowNumber.But what is this:Select *, (XXXXXXXXXXXX) As TotalRowCount FROM CategoriesWHERE rownum ...Order by RowNumIs it just getting the Total # of rows ? If so, will that value be displayed for ALL the rows? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-07-02 : 19:20:42
|
| Your application decides what to display.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|
|