March 13, 2008 at 10:37 pm
Indexed multi-table view... multi-table SELECT... which one will you call UPDATEable? Neither in all likely hood. An update would have to be something separate... paging isn't used to update... π
--Jeff Moden
Change is inevitable... Change for the better is not.
March 13, 2008 at 10:39 pm
Jeff Moden (3/13/2008)
Indexed multi-table view... multi-table SELECT... which one will you call UPDATEable? Neither in all likely hood. An update would have to be something separate... paging isn't used to update... π
Agreed. Just making sure:).
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
March 14, 2008 at 4:20 am
all possible ways are discussed above but think about
not in using top
select top 10 *
from table
where id not in (select top 20 id from table)
and cte
WITH Folder (IsUserFolder ,ParentFolderRowGUID ,RowGUID)
AS
(
SELECT *
FROM dbo.tblFolder AS P
whereRowGUID = @pRowGUID
UNION ALL
SELECT P.*
FROM dbo.tblFolder AS P
INNER JOIN Folder AS d
ON p.RowGUID = d.ParentFolderRowGUID
)
select top 1 * FROM Folder
where class filters the records
March 14, 2008 at 8:40 am
Using Adam's sample data:
-- Top 21 TO 30 (less than one second)
SELECT TOP 10 * FROM (
SELECT TOP 30 * FROM dbo.TestData ORDER BY RowNum
) t ORDER BY RowNum DESC
-- Top 999,981 to 999,990 (one second)
SELECT TOP 10 * FROM (
SELECT TOP 999990 * FROM dbo.TestData ORDER BY RowNum
) t ORDER BY RowNum DESC
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply