teste sql

C code posted by teste
created at 14 Jul 22:44, updated at 20 Jul 11:21

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
DECLARE @Skip int
DECLARE @Take int

SET @Skip = 0     -- The number of records to skip
SET @Take = 10  -- The number of records to return

SELECT * FROM (
   SELECT ROW_NUMBER() OVER (ORDER BY [t0].[ID], [t0].[Name], [t0].[Address]) AS [ROW_NUMBER],
         [t0].ID, [t0].Name, [t0].Address
   FROM [Company] AS [t0] ) AS [t1]
WHERE [t1].[ROW_NUMBER] BETWEEN @Skip + 1 AND @Skip + @Take
ORDER BY [t1].[ROW_NUMBER] 
427 Bytes in 4 ms with coderay